移动到windows 8,我正尝试在powershell中运行以下程序
# Load the Web Management and Administration Assembly
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Management")
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration")
$ServerManager = New-Object Microsoft.Web.Administration.ServerManager
$defaultSite = $ServerManager.Sites["Default Web Site"];站点数组为空
正在运行
appcmd.exe list sites给出
SITE "Default Web Site" (id:1,bindings:http/*:80:,state:Started)这在装有windows 7的IIS 7上有效
谢谢,
发布于 2013-02-18 10:26:38
通过大量的网络搜索,产生了以下解决方案
使用
$computer = gc env:computername
$ServerManager = [Microsoft.Web.Administration.ServerManager]::OpenRemote($computer.ToLower())
$defaultSite = $ServerManager.Sites["Default Web Site"];产生了想要的结果。希望这对将来的其他人有所帮助。
https://stackoverflow.com/questions/14869005
复制相似问题