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:\folder\attachment.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:\Users\username\Desktop\file\abstract.jpg"
Link to the Original Script for download.