Skip to content

Instantly share code, notes, and snippets.

@JeremyMorgan
Created March 9, 2019 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeremyMorgan/71ae6ee34d66ad08bf947bad9cafc61a to your computer and use it in GitHub Desktop.
Save JeremyMorgan/71ae6ee34d66ad08bf947bad9cafc61a to your computer and use it in GitHub Desktop.
Get Folder by Application Name in IIS
[Void][Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration")
$siteName = "Default Web Site"
$vApp = "/HV"
$serverManager = New-Object Microsoft.Web.Administration.ServerManager
$site = $serverManager.Sites | where { $_.Name -eq $siteName }
$rootApp = $site.Applications | where { $_.Path -eq $vApp }
$rootVdir = $rootApp.VirtualDirectories | where { $_.Path -eq "/" }
$prevPath = $rootVdir.PhysicalPath
#Set-OctopusVariable -name "PreviousPath" -value "$prevPath"
Write-Host $prevPath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment