#Send a message to a user
Function Send-Message ($Computername,$Message,$Duration,$Sessionname)
    {
        If ($Duration -eq $null) {$Duration = 0}
        $Computers = $Computername.Split(",")
        $count = $Computers.Count
        $i = 1
        ForEach ($Computername in $Computers)
            {
                $Percent = ($i/$count) * 100
                Show-ProgressBar -Activity "Sending $Computername a message" -PercentComplete $Percent
                Try 
                    {
               
                       start-process "C:\Windows\system32\msg.exe" " /Server:$Computername $Sessionname /Time:$Duration $Message" -ErrorAction SilentlyContinue -NoNewWindow
                    }
                Catch
                    {
                        Write-Host "Could Not find computer"
                    }
                $i++
            }
    }