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
4,702 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 250 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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 250 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 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