Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
ItemXPath      : /system.webServer/defaultDocument
Attributes     : {}
ChildElements  : {}
ElementTagName : files
Methods        :
Schema         : Microsoft.IIs.PowerShell.Framework.ConfigurationElementSchema

which doesn't really help.

share|improve this question
up vote 5 down vote accepted

The actual document names are deeper in the hierarchy. Here's how you can get a list of default docs:

Get-WebConfigurationProperty -Filter /system.webServer/defaultDocument/files/add -PSPath "IIS:\sites\Default Web Site" -Name value | Select value
share|improve this answer
Spot on. Thanks very much. – SGarratt Oct 22 '12 at 16:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.