Automatic Meeting Generator Using PowerShell (Generic and On-Boarding)

Today I come to you with a PowerShell Script written to generate meeting invites in mass quantity.

Here was the Problem Statement:

  • Problem:
    • As a helpful employee, I need to be able to generate (in-mass) meeting invites to a bunch of different people with various subjects for my boss when he asks
      • Side note: These were on-boarding meetings so this definitely will be done for on-boarding in the future for other employees
    • These meetings with the same people will 100% be needed to done again in the future so it needs to be automated
  • Solution:
    • Using the Outlook command-line extensions I can create a automated PowerShell script that can generate meetings in bulk

Here is the Code (Generic Version – Non On-Boarding):

$OUTLOOK = "C:\Program Files (x86)\Microsoft Office\root\Office16\OUTLOOK.EXE"

$MEETING_HASHMAP = @{ }

function generateParticipants {
    $PARTICIPANT_LIST = $args[0]

    $PARTICIPANT_STRING_TO_RETURN = ""

    foreach ($PARTICIPANT in $PARTICIPANT_LIST) {
        $PARTICIPANT_STRING_TO_RETURN = $PARTICIPANT_STRING_TO_RETURN + ";" +  $PARTICIPANT
    }

    return $PARTICIPANT_STRING_TO_RETURN
}

function createMeeting {
    
    $SUBJECT = $args[0]
        
    $BODY = $args[1]

    $PARTICIPANT_LIST = $args[2]

    $TO = generateParticipants $PARTICIPANT_LIST

    $MEETING_CONTENTS = "$TO&subject=$SUBJECT&body=$BODY"

    Start-Process -WindowStyle Maximized -FilePath "$OUTLOOK" -ArgumentList "/c ipm.appointment /m `"$MEETING_CONTENTS`""
}

function addMeeting {
    $SUBJECT_OF_MEETING = $args[0]
    $PARTICIPANT_LIST = $args[1]
    $MEETING_HASHMAP.Add($SUBJECT_OF_MEETING, $PARTICIPANT_LIST)
}

function generateMeetingInvites {
    foreach ($SUBJECT_OF_MEETING in $INTRODUCTION_HASHMAP.Keys) {
        $PARTICIPANT_LIST = $MEETING_HASHMAP[$SUBJECT_OF_MEETING]
        createMeeting $SUBJECT_OF_MEETING "Meeting Body" $PARTICIPANT_LIST
        Start-Sleep -Seconds 2
    }
}

$SUBJECT_OF_MEETING = "Quality Assurance"
$PARTICIPANT_LIST = New-Object Collections.Generic.List[String]
$PARTICIPANT_LIST.Add("bob.dole@company.com")
$PARTICIPANT_LIST.Add("jed.i.knighte@company.com")
addMeeting $SUBJECT_OF_MEETING $PARTICIPANT_LIST

$SUBJECT_OF_MEETING = "Software Development"
$PARTICIPANT_LIST = New-Object Collections.Generic.List[String]
$PARTICIPANT_LIST.Add("bob.dole@company.com")
$PARTICIPANT_LIST.Add("jed.i.knighte@company.com")
addMeeting $SUBJECT_OF_MEETING $PARTICIPANT_LIST

generateMeetingInvites

Here is the Other Code (On-Boarding Version):

$PERSON_NAME="Randy Pausch"
$PERSON_JOB_TITLE="Senior Imagineer"
$PERSON_EMAIL="randy.pausch@carnigie.edu"

$OUTLOOK = "C:\Program Files (x86)\Microsoft Office\root\Office16\OUTLOOK.EXE"

$INTRODUCTION_HASHMAP = @{ }

function generateSubject {
    $PERSON_JOB_TITLE = $args[0]
    $PERSON_NAME = $args[1]
    $DEPARTMENT_NAME = $args[2]

    return "Intro of New $PERSON_JOB_TITLE $PERSON_NAME to $DEPARTMENT_NAME"
}

function generateParticipants {
    $PARTICIPANT_LIST = $args[0]

    $PARTICIPANT_STRING_TO_RETURN = ""

    foreach ($PARTICIPANT in $PARTICIPANT_LIST) {
        $PARTICIPANT_STRING_TO_RETURN = $PARTICIPANT_STRING_TO_RETURN + ";" +  $PARTICIPANT
    }

    $PARTICIPANT_STRING_TO_RETURN = $PARTICIPANT_STRING_TO_RETURN + ";" + $PERSON_EMAIL

    return $PARTICIPANT_STRING_TO_RETURN
}

function createMeeting {
    $PERSON_JOB_TITLE = $args[0]
    
    $PERSON_NAME = $args[1]
    
    $DEPARTMENT_NAME = $args[2]
    
    $BODY = $args[3]
    
    $TO_ARRAY = $args[4]

    $SUBJECT = generateSubject $PERSON_JOB_TITLE $PERSON_NAME $DEPARTMENT_NAME

    $TO = generateParticipants $TO_ARRAY

    $MEETING_CONTENTS = "$TO&subject=$SUBJECT&body=$BODY"

    Start-Process -WindowStyle Maximized -FilePath "$OUTLOOK" -ArgumentList "/c ipm.appointment /m `"$MEETING_CONTENTS`""
}

function addDepartment {
    $DEPARTMENT_NAME = $args[0]
    $PARTICIPANT_LIST = $args[1]
    $INTRODUCTION_HASHMAP.Add($DEPARTMENT_NAME, $PARTICIPANT_LIST)
}

function generateMeetingInvites {
    foreach ($DEPARTMENT_NAME in $INTRODUCTION_HASHMAP.Keys) {
        createMeeting $PERSON_JOB_TITLE $PERSON_NAME $DEPARTMENT_NAME "Overview of Department and Practices" $INTRODUCTION_HASHMAP[$DEPARTMENT_NAME]
        Start-Sleep -Seconds 2
    }
}


$DEPARTMENT_NAME = "Quality Assurance"
$PARTICIPANT_LIST = New-Object Collections.Generic.List[String]
$PARTICIPANT_LIST.Add("bob.dole@company.com")
$PARTICIPANT_LIST.Add("jed.i.knighte@company.com")
addDepartment $DEPARTMENT_NAME $PARTICIPANT_LIST

$DEPARTMENT_NAME = "Software Development"
$PARTICIPANT_LIST = New-Object Collections.Generic.List[String]
$PARTICIPANT_LIST.Add("bob.dole@company.com")
$PARTICIPANT_LIST.Add("jed.i.knighte@company.com")
addDepartment $DEPARTMENT_NAME $PARTICIPANT_LIST

generateMeetingInvites

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 )

Google photo

You are commenting using your Google 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