PowerShell修改根站点属性

时间:2014-07-23 14:29:55

标签: powershell iis-8.5

我需要在一些使用powershell的网站上设置serviceAutoStartProvider和serviceAutostartEnabled属性。

此cmdlet适用于具有Web应用程序的网站:

  

Set-ItemProperty IIS:\ Sites \ $ websiteName \ $ webApplicationName -name serviceAutoStartEnabled -Value' True'

对于没有网络应用程序的网站,我这样做

  

Set-ItemProperty IIS:\ Sites \ $ websiteName -name serviceAutoStartEnabled -Value' True'

但它没有用,我收到了这个错误

  

找不到属性serviceAutoStartEnabled

当我检查IIS的applicationHost.config文件时,每个网站都有一个默认的Web应用程序,那么,如何在根网站上设置这些属性?

谢谢,

1 个答案:

答案 0 :(得分:0)

我找到了这个cmdlet

  

Set-ItemProperty IIS:\ Sites \ $ siteName -name applicationDefaults.serviceAutoStartEnabled -Value'True'

它有效:)