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):
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: