PowerShell을 사용하여 IIS에서 기본 문서 목록을 어떻게 얻을 수 있나요?

PowerShell을 사용하여 IIS에서 기본 문서 목록을 어떻게 얻을 수 있나요?

저는 Server Core 컴퓨터를 관리하고 PowerShell에서 모든 작업을 수행하려고 하는데 재미있습니다. 기본 문서 목록이 필요합니다. 다른 웹사이트에서 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

정말 도움이되지 않습니다.

답변1

실제 문서 이름은 계층 구조에서 더 깊습니다. 기본 문서 목록을 얻는 방법은 다음과 같습니다.

Get-WebConfigurationProperty -Filter /system.webServer/defaultDocument/files/add -PSPath "IIS:\sites\Default Web Site" -Name value | Select value

관련 정보