【发布时间】:2011-03-21 16:12:50
【问题描述】:
在 Windows Server 2008(32 位)上执行 Power shell 脚本 (v1.0) 时出现异常。
它使用 ADSI 在删除之前搜索虚拟目录。
我得到以下异常:
Exception calling "Find" with "2" argument(s): "Exception from HRESULT: 0x80005008"
At line:1 char:29
+ $iisMgr.psbase.children.find <<<< ("MyVirtualDir", $iisMgr.psbase.SchemaClassName)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
这是代码:
$vDirPath = "IIS://localhost/W3SVC/1/Root"
$iisMgr = [adsi]$vDirPath
$iisMgr.psbase.children.find("MyVirtualDir", $iisMgr.psbase.SchemaClassName)
(编辑):从几个博客中我读到,必须启用 IIS6 管理兼容性角色服务才能安装 ADSI 提供程序,我已经启用它,仍然有这个异常......
【问题讨论】:
-
根据KB for 2000 (IIS5) 0x80005008 是
E_ADS_BAD_PARAMETER。 -
最后一个参数在 Powershell 编辑器中返回“IIsWebVirtualDir”...不知道为什么它给出了一个错误的参数
标签: exception powershell adsi