Day: December 10, 2018

  • GetLocalGroupsSID

    $computerName = Read-Host ‘Enter computer name or press <Enter> for localhost’ $List = @{} if ($computerName -eq “”) {$computerName = “$env:computername”} $computer = [ADSI]”WinNT://$computerName,computer” $Users = $computer.psbase.Children | Where-Object { $_.psbase.schemaclassname -eq ‘group’ } foreach ($i in $Users) {$objUser = New-Object System.Security.Principal.NTAccount($i.Name) $strSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier]) $list[$i.Name[0]] = $strSid.Value } $list | ft