PowerShell + WebAdministration - How to get website from webapplication?

后端 未结 3 616
滥情空心
滥情空心 2021-01-17 16:39

I\'m writing a PowerShell script to perform certain administrative functions in IIS 7.5.

import-module WebAdministration

In some cases I kn

3条回答
  •  遥遥无期
    2021-01-17 17:15

    This is how you can get the site name:

    $siteName = (Get-WebApplication -name 'YourApp').GetParentElement().Attributes['name'].Value
    

    Or even shorter:

    $siteName = (Get-WebApplication -name 'YourApp').GetParentElement()['name']
    

提交回复
热议问题