Indie101
asked on
Powershell script to bulk add AD accounts, mailboxes, password and security groups
Hi urgent query looking to get this done
Found below script at http://www.morgantechspace.com/2014/04/Create-Bulk-AD-Users-from-CSV-using-Powershell-Script.html
Have a test csv attached, I want to add exchange mailboxes and also 3 more security groups "Test members" "Test 2017" and "Test Wifi" what is the best way to do this?
Would it be just Add-ADgroup member "Domain Admins" "Test members" Test 2017" Test Wifi" $_."samAccountName";
Import-Module ActiveDirectory
Import-Csv "C:\Scripts\NewUsers.csv" | ForEach-Object {
$userPrincinpal = $_."samAccountName" + "@TestDomain.Local"
New-ADUser -Name $_.Name `
-Path $_."ParentOU" `
-SamAccountName $_."samAccountName" `
-UserPrincipalName $userPrincinpal `
-AccountPassword (ConvertTo-SecureString "MyPassword123" -AsPlainText -Force) `
-ChangePasswordAtLogon $true `
-Enabled $true `
-EmailAddress $_."EmailAddress"
Add-ADGroupMember "Domain Admins" $_."samAccountName";
}
Test.csv
Found below script at http://www.morgantechspace.com/2014/04/Create-Bulk-AD-Users-from-CSV-using-Powershell-Script.html
Have a test csv attached, I want to add exchange mailboxes and also 3 more security groups "Test members" "Test 2017" and "Test Wifi" what is the best way to do this?
Would it be just Add-ADgroup member "Domain Admins" "Test members" Test 2017" Test Wifi" $_."samAccountName";
Import-Module ActiveDirectory
Import-Csv "C:\Scripts\NewUsers.csv" | ForEach-Object {
$userPrincinpal = $_."samAccountName" + "@TestDomain.Local"
New-ADUser -Name $_.Name `
-Path $_."ParentOU" `
-SamAccountName $_."samAccountName" `
-UserPrincipalName $userPrincinpal `
-AccountPassword (ConvertTo-SecureString "MyPassword123" -AsPlainText -Force) `
-ChangePasswordAtLogon $true `
-Enabled $true `
-EmailAddress $_."EmailAddress"
Add-ADGroupMember "Domain Admins" $_."samAccountName";
}
Test.csv
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Using exchange 2010 in a hybrid office 365 environment
ASKER