Monday, January 3, 2011

Generate sidHistory Report using DSQUERY command

Last week I blogged about generating sidHistory report using a PowerShell script - If you prefer to use dsquery command, you can use the following syntax to generate similar report.

dsquery * -Filter "(samaccountname=santhosh)" -Attr samAccountName ObjectSID sidHistory

You can also create a batch file with the following command generate a report from an input file (Users.txt):


For /f %%i in (C:\Users.txt) Do (

dsquery * -Filter "(samaccountname=%%i)" -Attr samAccountName ObjectSID sidHistory >> C:\User_Info.txt


As you can see in the following screenshot, the output file (User_Info.txt) contains the SamAccontName, ObjectSID and its sidHistory value:


Dsquery -


Post a Comment

Popular Posts


Twitter Delicious Facebook Digg Stumbleupon Favorites More