One more issue I am having. I am trying to export some properties to a csv file in this script I am building
IF($groupInfo.DirectoryType -eq 1){
$ObjGroupInfo = New-Object System.Object
$ObjGroupInfo | Add-Member -membertype Noteproperty -Name 'GroupName' -value $groupInfo.Name
$ObjGroupInfo | Add-Member -MemberType Noteproperty -Name 'DirectoryType' -Value $groupInfo.DirectoryType
$ObjGroupInfo | Add-Member -membertype Noteproperty -Name 'GUID' -value $groupInfo.GUID
#Insert into container$
$ArrangeInfo += $ObjGroupInfo
}
elseif ($groupInfo.DirectoryType -eq 2){
$groupInfo = $Context.BindToObjectByDN($dn)
$ObjGroupInfo = New-Object System.Object
$ObjGroupInfo | Add-Member -membertype Noteproperty -Name 'GroupName' -value $groupInfo.Name
$ObjGroupInfo | Add-Member -MemberType Noteproperty -Name 'DirectoryType' -Value $groupInfo.DirectoryType
$ObjGroupInfo | Add-Member -membertype Noteproperty -Name 'GUID' -value $groupInfo.GUID
First part dealing with AD groups works fine however when dealing with the Azure AD groups I am gettting two issues:
The $groupInfo.Name Returns something like this in the csv file: CN=ADX_CloudTest\0AUID:866f290f64fb4eccbcdce2c704fd5e6d
Also the $groupInfo.GUID
Returns a number that is not the object ID What should I use to get the objectID and correct name for the Azure AD groups. I've tried $groupinfo.ObjectId and $groupinfo.displayname and both of those are empty.