Active Directory-Powershell - Get-OU-details
Unten ist der code: PowerShell 2.0
$DomainDN = Get-ADDomain -Server $svr | Select DistinguishedName | Out-String
$CountryDN = Get-ADOrganizationalUnit -Server $svr -LDAPFilter '(name=Countries)' -SearchBase '$DomainDN' -SearchScope 0 | Select DistinguishedName | Out-String
Bei der Ausführung bekomme ich die folgende Fehlermeldung:
Get-ADOrganizationalUnit : The supplied distinguishedName must belong to one of the following partition(s): 'CN=Configuration,DC=lab,DC=mydomain,DC=com , CN=Sche
ma,CN=Configuration,DC=lab,DC=mydomain,DC=com , DC=eul,DC=lab,DC=mydomain,DC=com , DC=ForestDnsZones,DC=lab,DC=mydomain,DC=com , DC=DomainDns
Zones,DC=eul,DC=lab,DC=mydomain,DC=com'.
At line:3 char:38
+ $CountryDN = Get-ADOrganizationalUnit <<<< -Server $svr -LDAPFilter '(name=Countries)' -SearchBase '$DomainDN' -SearchScope 0 | Select DistinguishedName | Out-String
+ CategoryInfo : InvalidArgument: (:) [Get-ADOrganizationalUnit], ArgumentException
+ FullyQualifiedErrorId : The supplied distinguishedName must belong to one of the following partition(s): 'CN=Configuration,DC=lab,DC=mydomain,DC=com , CN=
Schema,CN=Configuration,DC=lab,DC=mydomain,DC=com , DC=eul,DC=lab,DC=mydomain,DC=com , DC=ForestDnsZones,DC=lab,DC=mydomain,DC=com ,
DC=DomainDnsZones,DC=eul,DC=lab,DC=mydomain,DC=com'.,Microsoft.ActiveDirectory.Management.Commands.GetADOrganizationalUnit
Kann mir bitte jemand helfen?
InformationsquelleAutor Rajiv | 2013-03-07
Du musst angemeldet sein, um einen Kommentar abzugeben.
Versuchen Sie es auf diese Weise:
select-object -expandproperty wird ein string zurückgegeben, anstatt eine PSObject Sie brauchen also nicht hin-string.
Bill
InformationsquelleAutor Bill_Stewart
oder
InformationsquelleAutor mjolinor