Hey Everyone,
I've scoured the interwebs for a few days now off and on to find this. I am creating a powershell script for email-enabling new
user's(Exchange 2007).
To give you a little background when we have a new hire, their AD
account is created at our off-site helpdesk, but they don't create their email
account.
I'm trying to automate the process of mail-enabling the
user which involves putting them in the same database as an existing
user, disable imap pop activesync, and lastly email the requester of the ticket.
I would like to just get prompted for the New
User's name,
User to Replicate(mailbox, storage group, database), and the person to email after it's been created.
So if someone could just help with a command to Retrieve a
user's Exchange database in powershell that would be great, but if people also want to help with my hacked up script please do so as well!!!
Here is what I have so far:
Write-output “ENTER THE FOLLOWING DETAILS”
$DName = Read-Host “User Diplay Name"
$RUser = Read-Host "Replicate User(Database Grab)"
***$RData = #get the Replicate
user's mailbox database here***
$REmail = #either just use a Read-Host “Requester's Email address" or ask for Requester's name and pipe through their email address by digging for it w/ powershell
Enable-Mailbox -Identity "$DName" -Database "$RData"
Send-MailMessage -From "John Doe <
[email protected]>" -To (put $REmail here which is the Requester's email) -Subject "Test Person's email
account" -Body "Test Person's email
account has been setup.`n`n`nJohn Doe`nGeneric Company`nSystems Administrator`nOffice: 123.456.7890`
[email protected]" -SmtpServer genericexchange.exchange.com