Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

up vote 2 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
add comment

Your Answer

 
discard

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.