Get AD user Properties across the forest

#get all AD users in forest with name like v- and status is enable

$allusers = (get-adforest).domains| %{get-aduser -filter {SamAccountName -like “v-*” -and Enabled -eq $true} -Properties EMployeeNumber -Server $psitem}

# get same account name and employenumber and destinguishname and saved to csv file
$allusers | ?{$PSItem.EmployeeNumber -eq $null} | select SamAccountName,EmployeeNumber,DistinguishedName,@{l=”Domain”;e={($PSItem.DistinguishedName -split “,DC=”)[1..4] -join “.”}} | Export-Csv c:\temp\employnumber.csv -NoTypeInformation

17 Comments

  1. I do agree with all of the ideas you’ve presented in your post. They’re very convincing and will certainly work. Still, the posts are too short for beginners. Could you please extend them a bit from next time? Thanks for the post.

  2. Thanks on your marvelous posting! I genuinely enjoyed reading it, you may be a great author.I will ensure that I bookmark your blog and will come back down the road. I want to encourage continue your great writing, have a nice day!

  3. Thank you for sharing superb informations. Your website is so cool. I’m impressed by the details that you have on this site. It reveals how nicely you understand this subject. Bookmarked this web page, will come back for extra articles. You, my friend, ROCK! I found just the information I already searched all over the place and simply could not come across. What a great website.

  4. Can I just say what a relief to find someone who actually knows what theyre talking about on the internet. You definitely know how to bring an issue to light and make it important. More people need to read this and understand this side of the story. I cant believe youre not more popular because you definitely have the gift.

  5. Pretty element of content. I simply stumbled upon your web site and in accession capital to claim that I get actually enjoyed account your blog posts. Anyway I’ll be subscribing in your augment or even I success you access consistently rapidly.

  6. I haven’t checked in here for some time because I thought it was getting boring, but the last few posts are great quality so I guess I’ll add you back to my daily bloglist. You deserve it my friend 🙂

Leave a Reply

Your email address will not be published.