get-website/get-webapplication相关目录

use*_*637 5 iis powershell

如果我想找到与IIS站点或应用程序关联的目录,我该怎么做?

我似乎无法在任何物体属性上找到任何东西,Get-WebsiteGet-WebApplication允许我这样做.

Pet*_*orf 12

只需看看网站的成员:

get-website -Name "Default Web Site" | Get-Member
Run Code Online (Sandbox Code Playgroud)

收益:

...
password                   NoteProperty          System.String password=
physicalPath               NoteProperty          System.String physicalPath=%SystemDrive%\inetpub\wwwroot
serverAutoStart            NoteProperty          System.Boolean  serverAutoStart=True
...
Run Code Online (Sandbox Code Playgroud)

这对我来说非常明显:

(Get-Website -Name "Default Web Site").PhysicalPath
Run Code Online (Sandbox Code Playgroud)

同样适用于应用程序:

(get-webapplication foo).PhysicalPath
Run Code Online (Sandbox Code Playgroud)