Ying Li at myITforum.com

PowerShell & System Center

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

Comments

No Comments