|
"A space for AD, Exchange and other technical stuff"
-- Where Information Technology Lives! --
|
|
|
Create an Active Directory user with Powershell. to run this script add a period (.) and drag the scrip into the powershell window. Example: [PS] C:\Documents and Settings\Administrator\Desktop>.C:\Documents and Settings\Administrator\Desktop\newuser.ps1
$location = Read-Host "Location: "
$Firstname = Read-Host "First Name: " $Lastname = Read-Host "LastName: " $name = $Firstname + " " + $Lastname $username = $Firstname[1] + $Lastname $domain = "E2K7.dw" $Userprincipalname = $name + "@" + $domain $password = Read-Host "Enter password: " -AsSecureString $Initials = $Firstname[1] + $Lastname[1] $OrganizationalUnit = 'E2k7.dw/DW Users' $Profile = '\\Myserver\profile' set-location $location New-Mailbox -Name $name ` -Alias $username ` -OrganizationalUnit $OrganizationalUnit ` -UserPrincipalName $Userprincipalname ` -SamAccountName $username ` -FirstName $Firstname ` -LastName $Lastname ` -Password $password ` -ResetPasswordOnNextLogon $false ` -Database 'CN=Mailbox Database,CN=First Storage Group,CN=InformationStore,CN=E2K7V,CN=Servers,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=DAT,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=E2k7,DC=dw' Or, something I had a very difficult time with, getting the script to pass the password from the spreadsheet. If you want the script to read a spreadsheet, that's pretty easy, but that last half of the password line alluded me. Import-CSV d:\scripts\Recipients.csv | foreach {new-mailbox -alias
$_.alias `
The spreadsheet needs to be in a csv format and have the appropriate headers. For this particular script the headers would look like: name,UPN,Firstname,Lastname,Password Modify to your liking of course. |
|
|