A script to set Calendar permissions and send welcome email.

A script to set Calendar permissions and send welcome email.

Hello all

We have a requirement in our company that all users calendars are set to reviewer. By default Exchange 2010, the calendar permissions are set to free/busy only.

Our helpdesk staff create user accounts by using templates in AD manager. I have written this powershell script, that can be executed from the custom attributes tab in the template. I hope it helps.

How to use:

In the template, add the following to the script field in custom attributes.

  1. powershell.exe .\setexchangepermissions.ps1 -admgr_usr %userName% -admgr_pass %pass% -admgr_email %mail%


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.

  1. #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! "





































                  New to ADSelfService Plus?