In class we received audit logs that contained only a SID. Since we were interested in getting the name of the client associated with that SID, we turned to PowerShell for the answer.
The SID actually contains two parts. A unique code for the domain and then the Relative Identifier (RID) for the the client. This RID is the last portion of the SID and is unique in the network. Below is an example.
S-1-5-21-3400766600-4132462866-2336755051-1149
The RID is the numbers 1149. This is what we need to search for in Active Directory. For a client, use this PowerShell command.
Get-ADComputer –Filter * –Properties | Where-Object {$_.SID –like “*1149”} | Select-Object –Property Name, SID
The Get-ADComputer cmdlet will retrieve all computer objects in Active Directory. The –Properties parameter will add the SID to the default set of attributes that are returned from the Get-ADComputer cmdlet.
The Where-Object cmdlet will filter all the computer objects for one with a SID that ends in 1149.
The Select-Object cmdlet will remove all attributes from the output except the name and the SID.
Comments