
Estoy administrando una máquina Server Core e intento hacer todo en PowerShell, lo cual es divertido. Necesito una lista de los documentos predeterminados. En otros sitios web, descubrí cómo configurarlos y eliminarlos, usando xxx-WebConfiguration y xxx-WebConfigurationProperty. He intentado:
Get-WebConfigurationProperty -Filter /system.webServer/defaultDocument -PSPath "IIS:\sites\Default Web Site" -Name files
pero da:
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
lo que realmente no ayuda.
Respuesta1
Los nombres reales de los documentos están más profundos en la jerarquía. Así es como puede obtener una lista de documentos predeterminados:
Get-WebConfigurationProperty -Filter /system.webServer/defaultDocument/files/add -PSPath "IIS:\sites\Default Web Site" -Name value | Select value