Share via


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
}

Comments

  • Anonymous
    January 01, 2003
    You might want to extract the domain names and set them as a variable in the beginning of the script for easier modification by users.  Also, the use of write-host is not encouraged.  It is better to create an array and then output objects that can be modified.

  • Anonymous
    January 01, 2003
    Fair comment and normally i would agree, but in this case i will disagree with the array part, the synthetic transactions dont lend them self well to been thrown into an array. I would have to tag names and then match names to rows in an array (hope i get it right aswell!) and for what i was trying to achieve is a little bit overkill and for others makes the script difficult to expand. will add the domain part later today... Thanks for your comments as normally i would process in arrays even though i am very bad at it! :)

  • Anonymous
    September 15, 2011
    I am in a crash course on using PowerShell with Lync. From my Test envrionment I wanted to test the CU3 update I applied last week. I opened the Lync PowerShell command promopt. I ran 'set-executionpolicy unrestricted'. the I ran a vbs file which contains the above script. It does not pop back with enter doaminuser name. it scrolls through and does not appear to work.

  • Anonymous
    September 27, 2011
    Jack Seth: Try naming the file .ps1  It is a PS-script, not VBS.

  • Anonymous
    February 17, 2016
    The comment has been removed