Link to home
Start Free TrialLog in
Avatar of P S
P S

asked on

Need help in modifying an existing script

I've a script to create bul kuser accounts. Script is working fine and accounts are getting created properly, However i Need help in modifying this script.

for all accounts that are getting created, I need to set a common atribute "XYZ" to value "112233". Can someone help me modifying the existing script.

FYI, Below is the script.

Import-Csv C:Temp\BulkAccountcreation.csv | foreach-object {
$userprinicpalname = $_.SamAccountName + “@Test.COM”  
New-ADUser -SamAccountName $_.SamAccountName -UserPrincipalName $userprinicpalname -Name $_.name -DisplayName $_.name -GivenName $_.cn -SurName $_.sn -Department $_.Department -Path “OU=Test,OU=Test2,OU=Test1,OU=Test,DC=Test,DC=COM” -AccountPassword (ConvertTo-SecureString “Microsoft~1;” -AsPlainText -force) -Enabled $True -PasswordNeverExpires $True -PassThru }

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of P S
P S

ASKER

Thanks oBdA. I'll follow your advice for the next script and yes, it worked perfectly. Thanks again.