Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Creating bulk user accounts using ad

$
0
0

I found this script and i modified it

Import-CSV E:\Users\ntaccount.csv | ForEach { 
$user = @{
name=$_.name;
displayname=$_.displayname;
Path=$_.Path
givenname=$_.givenname;
surname=$_.surname;
SAMAccountName=$_.SAMAccountName;
LogonName=$_.LogonName;
Street=$_.street;
City=$_.city;
PostalCode=$_.postalcode;
Country=$_.Country;
Description=$_.description;
emailaddress=$_.emailaddress;
accountpassword=(ConvertTo-SecureString "Temp@1234" -AsPlainText -Force);
};
New-ADUser @user -Enabled $True
Enable-Mailbox $user.samaccountname
}

When i run this script it gives me errors

Error 1

It's not accepting the LOGONNAME. Under account tab in AD. user logon name should be by samaccountname (Sidrao@acbnet.com)

Error 2

It;s not accepting the Enable-mailbox command

Please advise


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>