tom*_*mas 0 powershell active-directory
我对powershell脚本不是很熟悉,而且我遇到了这个问题:我需要对检索到的对象进行一些操作,如下所示:
$object = [ADSI]'LDAP://CN=Test User,OU=Dept,OU=Users,DC=example,DC=org'
...
$object.Commit()
Run Code Online (Sandbox Code Playgroud)
这工作正常,但我必须使用存储在变量中的专有名称 - 我的测试脚本看起来像这样,但它不起作用:
$object = [ADSI]'LDAP://$variable'
...
$object.Commit()
Run Code Online (Sandbox Code Playgroud)
第一次调用[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
Run Code Online (Sandbox Code Playgroud)
我很确定,参数是以某种错误的方式发送的,但我不知道,如何修复它,有人可以帮忙吗?
tahnks
| 归档时间: |
|
| 查看次数: |
1479 次 |
| 最近记录: |