Share This Post

PowerShell script to create AD accounts (II)

In my previous post, I blogged about how to create AD accounts using PowerShell and Quest PowerShell commands for AD. Below is a similar script with some modifications.

What happens you get a csv file which doesn’t have a name column but have lastname, firstname etc. You want to create the AD accounts with certain format such as test_lastname. We just need some concatenations.

import-csv Users1.csv |%{New-QADUser -ParentContainer ‘OU=abc, DC=xyz, Dc=com’ -name ($_.lastname+ ‘,’ +$_.firstname) -samAccountName(‘test_’ + $_.lastname)}

Share This Post

Ying Li obtained a Master degree of Medicine in China and worked in the medical field before he came to the states in 1996. He made the career switch from troubleshooting people to troubleshooting computers after he came to the states. Not entirely a surprise there, if you know that his second preference for college is Mathematics. Ying is two times Admin Framework MVP awardee (2007-2008).His previous employment experience in the US includes UUNET, MCI WorldCom. MMC (Marsh & McLennan Companies), Merrill Lynch. He is currently employed by Related Companies as a Senior Infrastructure Engineer. He is proficient in virtually all Microsoft products (Office/Back office). His craving for efficiency naturally leads him to scripting, automation and before you know it, PowerShell! He is currently a MCSE (NT4, 2000, 2003) and MCITP Server Administrator. Ying enjoys wines and love to travel. His non work related passion is to advocate Health Living!

Leave a Reply