Add a Calendar Meeting in Outlook through Powershell

The link at the bottom of this blog contains a good script that will allow you to create calendar meetings in Outlook through PowerShell.  This was helpful when I had to buildup a calendar in size to simulate another users exchange calendar for testing.    Below are the changes I made to the script so I could add attachments into newly created calendar appointments.  I know-I know, we shouldn’t be adding attachments into the appointment directly, hence the reason for the simulation of the problems the user is experiencing that needs to be proven.

I added this parameter/variable in the list of parameters:
    # Attachment Location, to hold value similart to: C:folderattachment.jpg
    [string] $file

I added this scriptlet to the Process:     
         $attachment = new-object System.Net.Mail.Attachment $file
         $newCalenderItem.Attachments.Add($file)

Boom. Now I can run the following command to create an appointment and add an attachment to build up the size of the calendar:

Add-CalendarMeeting -Subject “test recurring219” -Location “Steves Cube” -Body “Test” -MeetingStart “5/14/2014 18:00” -MeetingDuration 30  -file “C:UsersusernameDesktopfileabstract.jpg”

Link to the Original Script for download.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: