我想知道一个组织单位是否存在,所以我写了下面的代码,但它显示了一个错误:Impossible to find object with the identity OU_Bloquage.Despite it does really exist(I've created it) 下面是代码我写过
Import-Module ActiveDirectory
Import-Module 'Microsoft-PowerShell.Security'
$OUName = 'OU_Bloquage'
if([bool] (Get-ADOrganizationalUnit $OUName))
{ Write-Host 'true' }
else { Write-Host 'false' }