我想使用PowerShell在Windows7 64位上管理我的IIS7.
我尝试安装IIS7 Powershell管理单元 http://www.iis.net/download/PowerShell
我"以管理员身份运行",然后键入下面列出的命令:msiexec/I iis7psprov_x64.msi但我收到此错误消息:"PowerShell管理单元是Windows操作系统的一部分.请通过程序和功能或服务器管理器安装"
我认为加载WebAdministration模块不需要这个特殊功能,但我激活了"程序和功能"中的所有选项
打开或关闭Windows功能| IIS | Web管理工具| IIS管理脚本和工具
我做那些检查:
1.)安装Power-Shell
PS C:\Program Files\IIS> $Host.Version
Major Minor Build Revision
----- ----- ----- --------
2 0 -1 -1
PS C:\Program Files\IIS> $PSVersionTable
Name Value
---- -----
CLRVersion 2.0.50727.5448
BuildVersion 6.1.7601.17514
PSVersion 2.0
WSManStackVersion 2.0
PSCompatibleVersions {1.0, 2.0}
SerializationVersion 1.1.0.1
PSRemotingProtocolVersion 2.1
PS C:\Program Files\IIS> get-host
Name : ConsoleHost
Version : 2.0
InstanceId : 445ad8f5-87fc-48f7-b010-f7faf948b86c
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : es-ES
CurrentUICulture : es-ES
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed …Run Code Online (Sandbox Code Playgroud) 我有一个停止网站的脚本:
param($HostName = "localhost", $SiteName)
$server = $HostName
$siteName = $SiteName
$iis = [ADSI]"IIS://$server/W3SVC"
$site = $iis.psbase.children | where { $_.keyType -eq "IIsWebServer" -AND $_.ServerComment -eq $siteName}
$site.start()
# SIG # Begin signature block ...
Run Code Online (Sandbox Code Playgroud)
但是当我在具有高安全性策略的服务器上运行脚本时,我收到此错误:
The following exception was thrown when trying to enumerate the collection: "Unknown error (0x80005000)".
At D:\DeploymentScripts\Common\StopSite.ps1:6 char:8
+ $site = <<<< $iis.psbase.children | where { $_.keyType -eq "IIsWebServer" -AND $_.ServerComment -eq $siteName}
+ CategoryInfo : NotSpecified: (:) [], ExtendedTypeSystemException
+ FullyQualifiedErrorId : ExceptionInGetEnumerator
Run Code Online (Sandbox Code Playgroud)
从我所看到的,如果我无法访问IIS,可能会发生这种情况,但我以管理员身份运行脚本,是否应该授予我所需的访问权限? …