我正在pipe理Server Core机器,并试图在PowerShell中做所有事情,这很有趣。 我需要一个默认文档列表。 从其他网站,我已经find了如何设置和删除它们,使用xxx-WebConfiguration和xxx-WebConfigurationProperty。 我试过了:
Get-WebConfigurationProperty -Filter /system.webServer/defaultDocument -PSPath "IIS:\sites\Default Web Site" -Name files
但它给:
Collection : {Microsoft.IIs.PowerShell.Framework.ConfigurationElement, Microsoft.IIs.PowerShell.Framework.Configuration Element, Microsoft.IIs.PowerShell.Framework.ConfigurationElement, Microsoft.IIs.PowerShell.Framework.Confi gurationElement...} ItemXPath : /system.webServer/defaultDocument Attributes : {} ChildElements : {} ElementTagName : files Methods : Schema : Microsoft.IIs.PowerShell.Framework.ConfigurationElementSchema
这并没有真正的帮助。
实际的文档名称在层次结构中更深。 以下是如何获取默认文档的列表:
Get-WebConfigurationProperty -Filter /system.webServer/defaultDocument/files/add -PSPath "IIS:\sites\Default Web Site" -Name value | Select value