-
This solution uses ADSI and the .NET Framework to retrieve the name of the user's primary group: $rootDN = ([adsi]"").distinguishedName $user = [adsi]("LDAP://CN=testuser,OU=Test," + $rootDN) $groupID = $user.primaryGroupID $arrSID = $user.objectSid.Value $SID = New-Object System...