I found a script to fetch AD groups and its members in it. I was working fine but all a sudden it stopped working and gives an error.
List All Groups and Their Members with PowerShell on Win2008r2
$Groups = Get-ADGroup -Properties * -Filter * -SearchBase "OU=Groups,DC=corp,DC=ourcompany,DC=Com"
Foreach($G In $Groups)
{
Write-Host $G.Name
Write-Host "-------------"
$G.Members
}
Error
Get-ADGroup : The supplied distinguishedName must belong to one of the following partition(s): 'DC=AIA,DC=BIZ , CN=Configuration,DC=AIA,DC=BIZ , CN=Schema,CN=Configuration,DC=AIA,DC=BIZ , DC=ForestDnsZon
es,DC=AIA,DC=BIZ , DC=DomainDnsZones,DC=AIA,DC=BIZ'.
At C:\Users\zai_shanda\Desktop\adgroup.ps1:1 char:22
+ $Groups = Get-ADGroup <<<< -Properties * -Filter * -SearchBase "AIA.BIZ/AIA/New Zealand/ZAI/Groups/General"
+ CategoryInfo : InvalidArgument: (:) [Get-ADGroup], ArgumentException
+ FullyQualifiedErrorId : The supplied distinguishedName must belong to one of the following partition(s): 'DC=AIA,DC=BIZ , CN=Configuration,DC=AIA,DC=BIZ , CN=Schema,CN=Configuration,DC=AIA,DC=BIZ
, DC=ForestDnsZones,DC=AIA,DC=BIZ , DC=DomainDnsZones,DC=AIA,DC=BIZ'.,Microsoft.ActiveDirectory.Management.Commands.GetADGroup
can you please help what is wrong?