Suppose we have an AD Group with some members as foreign security principals. The format of the values in the member attribute in that case is as follows:
CN=S-1-5-21-XXXX-XXXXXXXX-XXXXXXXXX-XXXX,CN=ForeignSecurityPrincipals,DC=dmc,DC=001,DC=net
We have a translate command to trace the member using SID (S-1-5-21-XXXX-XXXXXXXX-XXXXXXXXX-XXXX);
([System.Security.Principal.SecurityIdentifier] $SID).Translate([System.Security.Principal.NTAccount]).value
Is there a way in powershell to extract out the SID from the member attribute?