Q. How can I use Dsquery and Dsget to get an object's SID?

John Savill

April 29, 2008

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. Dsquery can output many object attributes, including the SID (objectSID). The easiest way is to use a filter query to show the objectsid attribute, as in the following example:

dsquery * -filter "&(objectcategory=user)(samaccountname=john)" -attr objectsid

The return is:

objectsid S-1-5-21-2835294230-785241407-2532694646-1106

You can also use Dsget to get the distinguished name (DN), like the following example:

dsget user "cn=john savill,cn=users,dc=savilltech,dc=net" -sid

The return would be:

sid S-1-5-21-2835294230-785241407-2532694646-1106 dsget succeeded

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like