pingcastle
pingcastle copied to clipboard
powershell script and non english domains
Hello,
in "check for hidden group memberships for user accounts" there is this ps-script
Get-ADUser -Filter * -Properties PrimaryGroup | Where-Object { $_.PrimaryGroup -ne (Get-ADGroup -Identity "Domain user").DistinguishedName } | Select-Object UserPrincipalName,PrimaryGroup
The scripts does not work on german systems. The group name must be localized like this
Get-ADUser -Filter * -Properties PrimaryGroup | Where-Object { $_.PrimaryGroup -ne (Get-ADGroup -Identity "Domänen-Benutzer").DistinguishedName } | Select-Object UserPrincipalName,PrimaryGroup
Would it possible to modify the script in the document this way
$DomainUsersSid = New-Object System.Security.Principal.SecurityIdentifier ([System.Security.Principal.WellKnownSidType]::AccountDomainUsersSid,(Get-ADDomain).DomainSID) Get-ADUser -Filter * -Properties PrimaryGroup | Where-Object { $_.PrimaryGroup -ne (Get-ADGroup -Filter {SID -eq $DomainUsersSid} ).DistinguishedName } | Select-Object UserPrincipalName,PrimaryGroup
Greetings Andreas