[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Powershell script that will list all users that have SID history after ADMT was completed and export to .CSV File

Posted on 2011-02-14
10
Medium Priority
?
5,156 Views
Last Modified: 2012-05-11
Powershell script that will list all users that have SID history after ADMT was completed and export to .CSV File
0
Comment
Question by:mjm21
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
10 Comments
 
LVL 11

Expert Comment

by:Tasmant
ID: 34889262
dsquery * -limit 0 -filter "&(objectclass=user)(objectcategory=person)(sIDHistory=*)" -attr distinguishedname
0
 
LVL 11

Accepted Solution

by:
Tasmant earned 1000 total points
ID: 34889273
dsquery * -limit 0 -filter "&(objectclass=user)(objectcategory=person)(sIDHistory=*)" -attr distinguishedname > users_with_sidhistory.csv
0
 
LVL 71

Expert Comment

by:Chris Dent
ID: 34889298
Hey,

Using Quest's tools? :) http://www.quest.com/powershell/activeroles-server.aspx
Get-QADUser -LdapFilter "(sidHistory=*)" -IncludedProperties SidHistory |
  Select-Object Name, DN, SidHistory |
  Export-Csv "output.csv"

Open in new window

HTH

Chris
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Author Comment

by:mjm21
ID: 34889643
Wow!  that was quick you guys are good.  Are you folks familar or have you used the ADMT (active directory migration tool)?  If you have then you know that when you migrate a user to another domain you have the option of migrating sid history.  So, what I am looking for is to see which users that were migrated with SID history.  The commands above will do this on the entire domain?
0
 
LVL 71

Expert Comment

by:Chris Dent
ID: 34890252

I have used ADMT, and the snippet I posted will check for and return all users who have SIDHistory set along with the value it's been set to. The value itself may be of limited use, it has to be converted to appear as the value we're used to seeing.

The only addition you might need with mine is "-SizeLimit 0" after Get-QADUser, without that it will return a few hundred results and stop (I forget if it returns 100 or 1000 by default).

If you cannot use Get-QADUser for any reason please say, I can give you a native version of the same snippet.

Chris
0
 

Author Comment

by:mjm21
ID: 34899839
Tasmant

Where is the output file of users_with_sidhistory.csv end up?
0
 
LVL 71

Assisted Solution

by:Chris Dent
Chris Dent earned 1000 total points
ID: 34899859

> Where is the output file of users_with_sidhistory.csv end up?

The directory you ran the command in. The path is relative, but you could always make it absolute:

dsquery * -limit 0 -filter "&(objectclass=user)(objectcategory=person)(sIDHistory=*)" -attr distinguishedname > c:\users_with_sidhistory.csv

Chris
0
 

Author Comment

by:mjm21
ID: 34899900
Checking out now.  thx
0
 

Author Comment

by:mjm21
ID: 34900098
Tasmant

Ok.  One more related to this.  What if I wanted to do only a particular OU?
0
 
LVL 71

Expert Comment

by:Chris Dent
ID: 34900294
I'll just answer that one too ;)

This should work:
dsquery * "OU=somewhere,DC=domain,DC=com" -limit 0 -filter "&(objectclass=user)(objectcategory=person)(sIDHistory=*)" -attr distinguishedname > c:\users_with_sidhistory.csv 

Open in new window

Chris
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Always backup Domain, SYSVOL etc.using processes according to Microsoft Best Practices. This is meant as a disaster recovery process for small environments that did not implement backup processes and did not run a secondary domain controller that ne…
After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question