Hello guys, i'm just a powershell beginner. Maybe i can find somebody who could
help with a problematic like follows:
i want to create smtp adresses depends on company entry in ADS, e.g. for about 30 different companies with own domains. The user already exists in AD with all properties like company, alias, Displayname, firstname, lastname. I just like to enable the email function, set a primary SMTP based of different domains depends
on the company entry. e.g.
Company1 @company1.com
Company2 @company2.com
So i like to generate the smtp with parameters firstname.lastname@company1.com
First i have to search for different userIDs in AD and put the information to a variable. Then i could to ask with if/else for each userid and put the correct @domain and create the primarySMTP.
I'm getting a csv list it looks like follows e.g.
Header
UserID Product OrderID
K0300,MSX2010,O12345
K0301,MSX2010,O12346
As i said the User already exists in AD without Mailadress. Then i like to enablembx create the primary SMTP depends on company_name and write the OrderID and date to the description field.
The script should works like this:
1. ImportCSV
2.EnableMBX of all Users and generate smtp
3.ExportCSV before i've to add the generated SMTP to a new column called SMTP
i'm really overhelmed with this requirement, I really hope i can find someone who can support me. Thank you so much in advanced.
MAX
i want to create smtp adresses depends on company entry in ADS, e.g. for about 30 different companies with own domains. The user already exists in AD with all properties like company, alias, Displayname, firstname, lastname. I just like to enable the email function, set a primary SMTP based of different domains depends
on the company entry. e.g.
Company1 @company1.com
Company2 @company2.com
So i like to generate the smtp with parameters firstname.lastname@company1.com
First i have to search for different userIDs in AD and put the information to a variable. Then i could to ask with if/else for each userid and put the correct @domain and create the primarySMTP.
I'm getting a csv list it looks like follows e.g.
Header
UserID Product OrderID
K0300,MSX2010,O12345
K0301,MSX2010,O12346
As i said the User already exists in AD without Mailadress. Then i like to enablembx create the primary SMTP depends on company_name and write the OrderID and date to the description field.
The script should works like this:
1. ImportCSV
2.EnableMBX of all Users and generate smtp
3.ExportCSV before i've to add the generated SMTP to a new column called SMTP
- CODE: SELECT ALL
$User=IMPORT-CSV C:\Imports\Users.csv
$user = import-csv C:\Imports\Users.csv | Select-Object UserId | % {$_.domain = if($_.Company -eq “company1”) {“@company1.com”} elseif ($_.company -eq “company2”){“@company2.com”}}
- CODE: SELECT ALL
Get-Mailbox -importCSV USERID | foreach {
Set-Mailbox $_.alias -primarySmtpAddress ("{0}.{1}@company1.com" -f $_.firstname,$_.lastname) -emailAddressPolicyEnabled $false
- CODE: SELECT ALL
import-csv .\users.csv | Select-Object userID,product,orderid | Export-csv usersfinished.csv -NoTypeInformation
i'm really overhelmed with this requirement, I really hope i can find someone who can support me. Thank you so much in advanced.
MAX