Original script From : Script to download
When you have downloaded and extracted the scripts to your server – open a Powershell Console and navigate to the location where they are located – when there type in:
.\CreateUsersFromCSV.ps1
LabUsers01
When the script executes you will be presented with a Windows “Open” dialog box – navigate to the location where you extracted the files and then choose the sample CSV – see below;
LabUsers02
The script will then execute creating each user in your Active Directory Lab environment – the Default password is “Password1” – see below;
LabUsers03
When the script has completed – open Active Directory Users and Computers – you will see a new OU called “ExchangeUsers” – within this OU are the new accounts that you can play with – see below;
LabUsers04
Enable the users using Power Shell
Get-User -Filter {Department -Like 8* -And RecipientType -eq User} | % { Enable-MailUser $_ -externalEmailAddress $($_.name)@angrytech.com}
Another Script
-------------------------------
Get-User | Where-Object{$_.RecipientType –eq “User”}
Get-User –OrganizationalUnit People | Where-Object{$_.RecipientType –eq “User”}
get-user –organizationalUnit people | where-object{$_.RecipientType –eq “User” -and $_.department –eq “Sales”}
get-user –organizationalUnit people | where-object {$_.RecipientType –eq “User” -and $_.department –eq “Sales”} | Enable-Mailbox –Database “EXCHANGE1\Mailbox Database” | get-mailbox | select name,windowsemailaddress,database
Steps
From the powershell, run the .\CreateUsersFromCSV.ps1
and the confirm the user from Get-User in Active directory at OU=ExchangeUsers and in the below Exchange shell command rename -OrganizationalUnit People
Get-user –organizationalUnit people | where-object {$_.RecipientType –eq “User” -and $_.department –eq “Sales”} | Enable-Mailbox –Database “EXCHANGE1\Mailbox Database” | get-mailbox | select name,windowsemailaddress,database
Run the command from Shell
get-mailbox | fl name, database and from the resultant replace the Database after Enable-Mailbox -Database ""
So the new command would be
get-user –organizationalUnit ExchangeUsers | where-object {$_.RecipientType –eq “User” -and $_.department –eq “Sales”} | Enable-Mailbox –Database “E2K7\First Storage Group\Mailbox Database” | get-mailbox | select name,windowsemailaddress,database
Here OrganizationUnit is the location from ADUC where Exchange users created
and E2K7\First Storage Group\Mailbox Database is an example from my E2k7 DB
When you have downloaded and extracted the scripts to your server – open a Powershell Console and navigate to the location where they are located – when there type in:
.\CreateUsersFromCSV.ps1
LabUsers01
When the script executes you will be presented with a Windows “Open” dialog box – navigate to the location where you extracted the files and then choose the sample CSV – see below;
LabUsers02
The script will then execute creating each user in your Active Directory Lab environment – the Default password is “Password1” – see below;
LabUsers03
When the script has completed – open Active Directory Users and Computers – you will see a new OU called “ExchangeUsers” – within this OU are the new accounts that you can play with – see below;
LabUsers04
Enable the users using Power Shell
Get-User -Filter {Department -Like 8* -And RecipientType -eq User} | % { Enable-MailUser $_ -externalEmailAddress $($_.name)@angrytech.com}
Another Script
-------------------------------
Get-User | Where-Object{$_.RecipientType –eq “User”}
Get-User –OrganizationalUnit People | Where-Object{$_.RecipientType –eq “User”}
get-user –organizationalUnit people | where-object{$_.RecipientType –eq “User” -and $_.department –eq “Sales”}
get-user –organizationalUnit people | where-object {$_.RecipientType –eq “User” -and $_.department –eq “Sales”} | Enable-Mailbox –Database “EXCHANGE1\Mailbox Database” | get-mailbox | select name,windowsemailaddress,database
Steps
From the powershell, run the .\CreateUsersFromCSV.ps1
and the confirm the user from Get-User in Active directory at OU=ExchangeUsers and in the below Exchange shell command rename -OrganizationalUnit People
Get-user –organizationalUnit people | where-object {$_.RecipientType –eq “User” -and $_.department –eq “Sales”} | Enable-Mailbox –Database “EXCHANGE1\Mailbox Database” | get-mailbox | select name,windowsemailaddress,database
Run the command from Shell
get-mailbox | fl name, database and from the resultant replace the Database after Enable-Mailbox -Database ""
So the new command would be
get-user –organizationalUnit ExchangeUsers | where-object {$_.RecipientType –eq “User” -and $_.department –eq “Sales”} | Enable-Mailbox –Database “E2K7\First Storage Group\Mailbox Database” | get-mailbox | select name,windowsemailaddress,database
Here OrganizationUnit is the location from ADUC where Exchange users created
and E2K7\First Storage Group\Mailbox Database is an example from my E2k7 DB
No comments:
Post a Comment