Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get-website/get-webapplication associated directory

Tags:

powershell

iis

If I wanted to find the directory associated with an IIS site or application, how would I do that?

I cannot seem to find anything on any properties of objects from Get-Website and Get-WebApplication that allow me to do so.

like image 457
user1054637 Avatar asked May 27 '15 16:05

user1054637


1 Answers

Just look at the members of a web site:

get-website -Name "Default Web Site" | Get-Member

returns:

...
password                   NoteProperty          System.String password=
physicalPath               NoteProperty          System.String physicalPath=%SystemDrive%\inetpub\wwwroot
serverAutoStart            NoteProperty          System.Boolean  serverAutoStart=True
...

that's pretty obvious to me:

(Get-Website -Name "Default Web Site").PhysicalPath

same for an Application:

(get-webapplication foo).PhysicalPath
like image 64
Peter Hahndorf Avatar answered Nov 07 '22 20:11

Peter Hahndorf