Powershell script - Synthetic transactions in Lync after a patch is deployed

here is the code... you need to run this on a front end server and this will test enterprise voice as well

add / remove bits you feel you need.... :)

 

 

 

set-executionpolicy unrestricted
import-module lync

Write-host "This script will test some core functionality to ensure the main components are working"
write-host "Please fill in the follow fields as prompted to ensure a success"
write-host

$user1 = Read-host "Please enter test user1 in the form domain\user and press enter"
$cred1 = Get-Credential $user1
$user2 = Read-host "Please enter test user2 in the form domain\user and press enter"
$cred2 = Get-Credential $user2

$getuser1 = get-csuser -identity $user1
$getuser2 = get-csuser -identity $user2
$sipadduser1 = $getuser1.sipaddress
$sipadduser2 = $getuser2.sipaddress

$testphonenumber = Read-host "Please Enter a test phone number in E164 format i.e. +44123412343"

 

write-host "Beginning Tests...."

write-host
write-host
$testim = test-csim -targetfqdn belocspool01.belfasttrust.local -sendersipaddress $sipadduser1 -receiversipaddress $sipadduser2
$testabs = test-csaddressbookSERVICE -targetfqdn belocspool01.belfasttrust.local -usersipaddress $sipadduser1
$testabWQ = test-csaddressbookwebquery -targetfqdn belocspool01.belfasttrust.local -usersipaddress $sipadduser1
$testav = test-csavconference -targetfqdn belocspool01.belfasttrust.local -sendersipaddress $sipadduser1 -sendercredential $cred1 -receiversipaddress $sipadduser2 -receivercredential $cred2
$testclientauth =  Test-CsClientAuth -TargetFqdn belocspool01.belfasttrust.local -UserSipAddress $sipadduser1 -UserCredential $cred1
$testdialinc = Test-CsDialinconferencing -TargetFqdn belocspool01.belfasttrust.local -UserSipAddress $sipadduser1 -UserCredential $cred1
$testpresence = test-cspresence -targetfqdn belocspool01.belfasttrust.local -subscribersipaddress $sipadduser1 -publishersipaddress $sipadduser2
$testp2pav = test-csp2pav -targetfqdn belocspool01.belfasttrust.local -sendersipaddress $sipadduser1 -receiversipaddress $sipadduser2
$testpstnoutbound = Test-CsPstnOutboundCall -TargetFqdn belocspool01.belfasttrust.local -UserSipAddress $sipadduser1 -TargetPstnPhoneNumber $testphonenumber
$testcsreg = test-csregistration -TargetFqdn belocspool01.belfasttrust.local -UserSipAddress $sipadduser1

CLS

write-host "Results of Tests....."
write-host
write-host
if ($testim.result -eq "Success")
{
 write-host "IM Testing Result = " $testim.result -foregroundcolor green -backgroundcolor black
}
elseif ($testim.result -eq "Failure")
{
 write-host "IM Testing Result = " $testim.result -foregroundcolor Red -backgroundcolor black
}

if ($testabs.result -eq "Success")
{
 write-host "Addressbookservice Testing Result = " $testabs.result -foregroundcolor green -backgroundcolor black
}
elseif ($testabs.result -eq "Failure")
{
 write-host "Addressbookservice Testing Result = " $testabs.result -foregroundcolor Red -backgroundcolor black
}

if ($testabwq.result -eq "Success")
{
 write-host "Addressbookwebquery testing result = " $testabwq.result -foregroundcolor green -backgroundcolor black
}
elseif ($testabwq.result -eq "Failure")
{
 write-host "Addressbookwebquery testing result = " $testabwq.result -foregroundcolor Red -backgroundcolor black
}

if ($testav.result -eq "Success")
{
 write-host "AV Conference testing result = " $testav.result -foregroundcolor green -backgroundcolor black
}
elseif ($testav.result -eq "Failure")
{
 write-host "AV Conference testing result = " $testav.result -foregroundcolor Red -backgroundcolor black
}

if ($testclientauth.result -eq "Success")
{
 write-host "Client Auth testing result = " $testclientauth.result -foregroundcolor green -backgroundcolor black
}
elseif ($testclientauth.result -eq "Failure")
{
 write-host "Client Auth testing result = " $testclientauth.result -foregroundcolor Red -backgroundcolor black
}

if ($testdialinc.result -eq "Success")
{
 write-host "DialinConferencing Testing Result = " $testdialinc.result -foregroundcolor green -backgroundcolor black
}
elseif ($testdialinc.result -eq "Failure")
{
 write-host "DialinConferencing Testing Result = " $testdialinc.result -foregroundcolor Red -backgroundcolor black
}

if ($testpresence.result -eq "Success")
{
 write-host "Presence Testing Result = " $testpresence.result -foregroundcolor green -backgroundcolor black
}
elseif ($testpresence.result -eq "Failure")
{
 write-host "Presence Testing Result = " $testpresence.result -foregroundcolor Red -backgroundcolor black
}

if ($testp2pav.result -eq "Success")
{
 write-host "P2PAV Testing Result = " $testp2pav.result -foregroundcolor green -backgroundcolor black
}
elseif ($testp2pav.result -eq "Failure")
{
 write-host "P2PAV Testing Result = " $testp2pav.result -foregroundcolor Red -backgroundcolor black
}

if ($testpstnoutbound.result -eq "Success")
{
 write-host "PSTN Outbound Testing Result = " $testpstnoutbound.result -foregroundcolor green -backgroundcolor black
}
elseif ($testpstnoutbound.result -eq "Failure")
{
 write-host "PSTN Outbound Testing Result = " $testpstnoutbound.result -foregroundcolor Red -backgroundcolor black
}

if ($testcsreg.result -eq "Success")
{
 Write-host "CS Registration Testing Result = " $testcsreg.result -foregroundcolor green -backgroundcolor black
}
elseif ($testcsreg.result -eq "Failure")
{
 Write-host "CS Registration Testing Result = " $testcsreg.result -foregroundcolor Red -backgroundcolor black
}