Monday, January 3, 2011

Generate sidHistory Report using DSQUERY command

Last week I blogged about generating sidHistory report using a PowerShell script - http://portal.sivarajan.com/2010/12/powershell-script-search-active.html. 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):

image

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:

image

Dsquery - http://technet.microsoft.com/es-es/library/cc754232(WS.10).aspx

0 comments:

Post a Comment

Popular Posts

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More