Nice little Synthetic transaction script for Skype For Business

Author by Brett Janzen

I was playing around with creating something that would not only test some synthetic transaction but output latency so if there are server performance I would know before it users. This emails the admin if the latency hits a threshold and or a failure.

This will test

  1. PSTN calls from Skype
  2. Peer to Peer Calls
  3. Test to the Edge from Front-ends
  4. Data Conferencing

More information can be found here.
https://docs.microsoft.com/en-us/powershell/module/skype/test-cspstnoutboundcall?view=skype-ps

Feel free to add more, such as Test-CsDialInConferencing (I am still working through some settings to make this work)

In the script I made the thresholds for the timing pretty low, feel free to tune them as needed
“elseif ($CallPstn.Latency.TotalSeconds -gt “10”){”

 

 

#Edit these values
$Email = “user@email.com”
$FromEmail = “SkypeServer@email.com”
$EmailServer = “smtp.email.com”
$EmailSubject = “Synthetic Transaction Tests”
$TestNumber = “+15555555555”
$PoolFQDN = “Pool.domain.com”

#PSTN calling test
$CallPstn = Test-CsPstnOutboundCall -TargetFqdn $PoolFQDN -TargetPstnPhoneNumber $TestNumber
$EmailBody = $CallPstn.Result, $CallPstn.’Error Message’, $CallPstn.Diagnosis, $CallPstn.Latency
out-file -FilePath .\CallingTest.txt -InputObject $EmailBody -Encoding ASCII -Width 50

If ($CallPstn.Result -ne “Success”) {
Send-MailMessage -from $FromEmail -to $Email -subject “$EmailSubject PSTN” -body “Failed Call Test ” -Attachment “.\CallingTest.txt” -smtpServer $EmailServer

} elseif ($CallPstn.Latency.TotalSeconds -gt “10”){
Send-MailMessage -from $FromEmail -to $Email -subject “$EmailSubject PSTN” -body “Might have an issue with Latency” -Attachment “.\CallingTest.txt” -smtpServer $EmailServer
}
#test Skype to Skype peer to peer calls
$TestP2P = Test-CsP2PAV -TargetFqdn $PoolFQDN
$EmailAttachment2 = $TestP2P.Result, $TestP2P.”Error Message”, $TestP2P.Diagnosis, $CallPstn.Latency
out-file -FilePath .\P2PTest.txt -InputObject $EmailAttachment2 -Encoding ASCII -Width 50
If ($TestP2P.Result -ne “Success”) {
Send-MailMessage -from $FromEmail -to $Email -subject $EmailSubject -body “Peer to Peer Test” -Attachment “.\TestP2P.txt” -smtpServer $EmailServer

} elseif ($TestP2P.Latency.TotalSeconds -gt “5”){
Send-MailMessage -from $FromEmail -to $Email -subject “$EmailSubject p2p” -body “Might have an issue with Latency” -Attachment “.\TestP2P.txt” -smtpServer $EmailServer
}

#test edge connectivity
$EdgeCon = Test-CsAVEdgeConnectivity -TargetFqdn $PoolFQDN
$EmailAttachment3 = $EdgeCon.Result, $EdgeCon.”Error Message”, $EdgeCon.Diagnosis, $EdgeCon.Latency
out-file -FilePath .\EdgeCon.txt -InputObject $EmailAttachment3 -Encoding ASCII -Width 50
If ($EdgeCon.Result -ne “Success”) {
Send-MailMessage -from $FromEmail -to $Email -subject $EmailSubject -body “Edge Connectivity” -Attachment “.\EdgeCon.txt” -smtpServer $EmailServer

} elseif ($EdgeCon.Latency.TotalSeconds -gt “4”){
Send-MailMessage -from $FromEmail -to $Email -subject “$EmailSubject Edge Con” -body “Might have an issue with Latency” -Attachment “.\EdgeCon.txt” -smtpServer $EmailServer
}

#test edge connectivity
$DataConf = Test-CsDataConference -TargetFqdn $PoolFQDN
$EmailAttachment4 = $DataConf.Result, $DataConf.”Error Message”, $DataConf.Diagnosis, $DataConf.Latency
out-file -FilePath .\DataConf.txt -InputObject $EmailAttachment4 -Encoding ASCII -Width 50
If ($DataConf.Result -ne “Success”) {
Send-MailMessage -from $FromEmail -to $Email -subject $EmailSubject -body “Data Conf” -Attachment “.\DataConf.txt” -smtpServer $EmailServer

} elseif ($DataConf.Latency.TotalSeconds -gt “11”){
Send-MailMessage -from $FromEmail -to $Email -subject “$EmailSubject Data Conf” -body “Might have an issue with Latency” -Attachment “.\DataConf.txt” -smtpServer $EmailServer
}

remove-item .\P2PTest.txt
remove-item .\CallingTest.txt
remove-item .\EdgeCon.txt
remove-item .\DataConf.txt

feel free to ask question!

thanks,
Brett