Next, copy the below code and save it as setexchangepermissions.ps1 in your AD Manager plus/bin directory. Careful of the word wrap. I have also attached it to this post.
What it does is make a connection to exchange 2010 using the rights of the user running the script, and modifies the calendar permissions to reviewer. It then sends a welcome email to the user.
- #Set Calendar permissions using AD Manager by Matthew Cowley 7/2/2013
#Takes arguments from the command line and stores them in a variable, for example if you specify .\SetCalendarPermissions.ps1 -admgr_user asmith the user asmith will be stored in the variable $admgr_usr
param([String]$admgr_usr,
[String]$admgr_pass,
[String]$admgr_email
)
#Connects to Exchange server management console using the locallay logged on user
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://your.exchange.FQDN.here/PowerShell/ -Authentication Kerberos
Import-PSSession $Session
#Changes the Calendar permission of the user supplied on the command line.
$path=$admgr_usr+":\Calendar"
Set-MailboxFolderPermission -Identity $path -User Default -Accessrights Reviewer
#sends email
Send-MailMessage -To $admgr_email -From "servicedesk@yourcompany" -SmtpServer Mail.yourdomain -Subject "Welcome to ABC Corp" -bodyashtml "A big welcome to ABC Corp from the IT Service Desk! "