0
我试图运行下面要设置处理映射每个PowerShell中使用APPCMD我们网站的阵列:APPCMD语法在PowerShell中
$websites = Get-ChildItem IIS:\Sites
foreach ($Site in $WebSites) {
C:\Windows\system32\inetsrv\appcmd set config "$site" /section:handlers -accessPolicy:"Read,Script,Execute"}
但是我收到此错误信息为每个站点当它遍历它们时:
ERROR (message:Cannot find SITE object with identifier "Microsoft.IIs.PowerShell.Framework.ConfigurationElement".)
我在做什么错?我尝试使用$ site变量的属性:
$site.name
但即使这样也行不通。我很茫然。谢谢!
试试'appcmd set config“$($ site.Name)”' –
这样做!非常感谢!!! –