Get Sid Script not working

Welcome Forums General PowerShell Q&A Get Sid Script not working

Viewing 1 reply thread
  • Author
    • #185579
      Topics: 35
      Replies: 110
      Points: 576
      Rank: Major Contributor

      Windows 2012 AD

      Trying to find the Account for the SID

      $SID = ‘S-1-5-21-3054588571-1341459584-784128302-1110’
      $objSID = New-Object System.Security.Principal.SecurityIdentifier($SID)
      $objUser = $objSID.Translate([System.Security.Principal.NTAccount])
      Write-Host “Resolved user name: ” $objUser.Value

      PS C:\util> $SID = ‘S-1-5-21-3054588571-1341459584-784128302-1110’
      PS C:\util> $sid
      PS C:\util> $objSID = New-Object System.Security.Principal.SecurityIdentifier($SID)
      PS C:\util> $objUser = $objSID.Translate([System.Security.Principal.NTAccount])
      Exception calling “Translate” with “1” argument(s): “Some or all identity references could not be translated.”
      At line:1 char:1
      + $objUser = $objSID.Translate([System.Security.Principal.NTAccount])
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : IdentityNotMappedException

      PS C:\util> Write-Host “Resolved user name: ” $objUser.Value
      Resolved user name:
      PS C:\util>

      Any ideas?

      Thank you


    • #185585
      Topics: 10
      Replies: 120
      Points: 670
      Helping Hand
      Rank: Major Contributor

      If you note the + FullyQualifiedErrorId : IdentityNotMappedException, the SID can’t be mapped to a known identity. This error will happen if the AD object doesn’t exist (now orphaned) and therefore cannot be mapped, or if for some reason the DC can’t be connected to.

Viewing 1 reply thread
  • The topic ‘Get Sid Script not working’ is closed to new replies.