get-adgroup -filter "SID -like '*-512'" get-adgroup -filter "SID -like '*-512'" powershell powershell

get-adgroup -filter "SID -like '*-512'"


As BenH comments, you cannot partially filter on SIDs in LDAP queries, because of the way SID values are stored in the directory. The SID string you see is an SDDL representation of an underlying byte array.

I assume your motivation for attempting wildcard matching against a well-known RID is that you don't know the domain SID in advance. You can easily obtain that with the Get-ADDomain cmdlet:

$DomainSID = (Get-ADDomain).DomainSID$DomainAdminsSid = New-Object System.Security.Principal.SecurityIdentifier ([System.Security.Principal.WellKnownSidType]::AccountDomainAdminsSid,$DomainSID)Get-ADGroup -Filter {SID -eq $DomainAdminsSid}