我不是很熟悉powershell脚本,我被这个问题卡住了-我需要对检索到的对象进行一些操作,如下所示:
$object = [ADSI]'LDAP://CN=Test User,OU=Dept,OU=Users,DC=example,DC=org'
...
$object.Commit()这可以很好地工作,但我必须使用存储在变量中的可分辨名称-我的测试脚本看起来像这样,但它不工作:
$object = [ADSI]'LDAP://$variable'
...
$object.Commit()第一次调用ADSI本身不会导致错误,但下面的任何操作都会崩溃,并显示消息:
The following exception occurred while retrieving member "commit": "The server is not operational.
"
At line:1 char:10
+ $object.commit <<<< ()
+ CategoryInfo : NotSpecified: (:) [], ExtendedTypeSystemException
+ FullyQualifiedErrorId : CatchFromBaseGetMember我很确定,参数是以某种错误的方式发送的,但我不知道,如何修复它,有人能帮助吗?
tahnks
发布于 2012-05-27 10:26:51
尝试:
$object = [ADSI]"LDAP://$variable"单引号不会展开变量。
https://stackoverflow.com/questions/10771093
复制相似问题