How can I get a list of default documents in IIS using PowerShell?
Posted
by
SGarratt
on Server Fault
See other posts from Server Fault
or by SGarratt
Published on 2012-10-15T14:17:00Z
Indexed on
2012/10/15
15:40 UTC
Read the original article
Hit count: 243
I'm managing a Server Core machine and trying to do everything in PowerShell, which is fun. I need a list of the default documents. From other websites, I've found out how to set and remove them, using both xxx-WebConfiguration and xxx-WebConfigurationProperty. I've tried:
Get-WebConfigurationProperty -Filter /system.webServer/defaultDocument -PSPath "IIS:\sites\Default Web Site" -Name files
but it gives:
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
which doesn't really help.
© Server Fault or respective owner