Public/Start-OfficeApp.ps1

Function Start-OfficeApp {
    <#
    .Synopsis
        Start an MS Office application
    .Description
        Start an MS Office application
    .Parameter Application
        Name of the application to start, valid options are: 'Access', 'Excel', 'InfoPathDesigner', 'InfoPathFiller', 'OneNote', 'Outlook', 'PowerPoint', 'Publisher', 'Word'
    .Example
        Start-OfficeApp
    .Inputs
        None
    .LINK
        about_functions_advanced
    .LINK
        about_CommonParameters
    #>

    [CmdletBinding()]
    [OutputType('None')]
    Param (
        [Parameter(Mandatory = $True)]
        [ValidateSet('Access', 'Excel', 'InfoPathDesigner', 'InfoPathFiller', 'OneNote', 'Outlook', 'PowerPoint', 'Publisher', 'Word')]
        [System.String[]]$Application
    )

    Begin {
    }

    Process {
        Foreach ($App in $Application) {
            Switch ($App) {
                'Access' { $App = "$Script:OfficePath\MSACCESS.EXE" }
                'Excel' { $App = "$Script:OfficePath\EXCEL.EXE" }
                'InfoPathDesigner' { $App = "$Script:OfficePath\INFOPATH.EXE" }
                'InfoPathFiller' { $App = "$Script:OfficePath\INFOPATH.EXE" }
                'OneNote' { $App = "$Script:OfficePath\ONENOTE.EXE" }
                'Outlook' { $App = "$Script:OfficePath\OUTLOOK.EXE" }
                'PowerPoint' { $App = "$Script:OfficePath\POWERPNT.EXE" }
                'Publisher' { $App = "$Script:OfficePath\MSPUB.EXE" }
                'Word' { $App = "$Script:OfficePath\WINWORD.EXE" }
                Default { "Invalid option"; break }
            }

            $Executable = $App.Split("\")[-1]
            $FileExists = Test-Path -Path $App

            If ($FileExists -eq "True") {
                If (!(Get-Process -Name $executable -ErrorAction SilentlyContinue)) {
                    Start-Process $App
                } Else {
                    $WarnMsg = ('{0} allready started!' -f $executable)
                    Write-Warning $WarnMsg
                }
            } Else {
                $ErrMsg = ('{0} not found' -f $executable)
                Write-Error $ErrMsg
            }
        }
    }
    End {
    }
}