上面的内容提供了:
PS C:\EndurAutomation\powershell\bin> C:\EndurAutomation\powershell\bin\ets_update_constring.ps1异常使用"0“参数调用"FindAll”:“发生操作错误。”At C:\EndurAutomation\powershell\bin\ets_update_constring.ps1:20 char:30 + $result = $ldapSearch.FindAll <<<< () + CategoryInfo : NotSpecified:(:) [],MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException
$ldapDN = "dc=<masked>,dc=<masked>"
$ldapURI = "ldap://<masked>/$ldapDN"
$env = "sqlplus -S <masked> ``@env.sql > env.list"
Invoke-Expression $env
$envData = (Get-Content "env.list")
$envFilter = "(|"
foreach ($env in $envData) {
$envFilter += "(cn=$env)"
}
$envFilter += ")"
$ldapEntry = New-Object System.DirectoryServices.DirectoryEntry($ldapUR, $null, $null, [System.DirectoryServices.AuthenticationTypes]::Anonymous)
$ldapSearch = New-Object System.DirectoryServices.DirectorySearcher($ldapEntry)
$ldapSearch.PageSize = 1000
$ldapSearch.Filter = $envFilter
$result = $ldapSearch.FindAll($envFilter)发布于 2012-02-06 22:04:14
您已经设置了$ldapSearch.Filter = $envFilter,因此不需要通过再次传入过滤器来调用FindAll。试着在你的最后一行代码中这样做,因为它仍然会内置你的过滤器:
$result = $ldapSearch.FindAll()发布于 2013-04-08 20:03:29
我认为这是一个打字错误:
$ldapEntry = New-Object System.DirectoryServices.DirectoryEntry(
**$ldapUR**, $null, $null,
[System.DirectoryServices.AuthenticationTypes]::Anonymous
)试一试
$ldapURI 而不是
$ldapURhttps://stackoverflow.com/questions/9161219
复制相似问题