Your Skype Powershell Cheat Sheet: Useful Powershell commands you can run in Skype for Business 2015 and Lync Server 2013


Hi All

I am a passionate Powershell and command line junky. I think that started with my first job which was Unix based and so I had to learn quickly the art of the commandline. Ever since then, I have tried hard to live by the mantra that “Real Men Don’t click” :). While that is not 100% the case with me these days, as I seem to spend so much time in Visio and Visio without a mouse is hell, I still try to use the command line (Powershell or CMD) as often as I can. As part of that mentality, and being a person who is always struggling to remember useful tidbits, I tend to keep a cheat sheet of useful commands and to this cheat sheet all the time. This is a cut down version, but I plan to keep adding to it over time. I hope you enjoy.

Steve

PS May the force be with you
*Is it difficult to tell I am excited about the upcoming Star Wars movie due for release in December?*

  • User Management
  • General Commands
    • Certificate Management
    • Lync File Share
    • Patching
    • Netmon Filters
    • Install Pre-Requisites
  • Database Management
  • Enterprise Voice
    • Enterprise Voice – Call Park
    • Enterprise Voice – Call Admission Control
    • Enterprise Voice – Team Call
    • Enterprise Voice – QoS
  • Snooper Codes
  • Office Web App


 

User Management

#Enabling a user for Enterprise Voice and issuing a phone number to the user.

Set-CsUser sip:clark@contoso.com -EnterpriseVoiceEnabled $True -LineUri “TEL:+6129161297”

#Move all users from SE02.contoso.org to Lync-Pool.contoso.org
Get-CSUser -filter {RegistrarPool -eq “se02.contoso.org”} | Move-CSUser -Target “lync-pool.contoso.org” -ignoreBackendStoreException -Force

#Find a user’s Routing Group
Get-CSUser sip:stevem@contoso.com | %{$strRoutingGroup= $_.UserRoutingGroupID.ToString() -replace “-“,””;Write-Host $strRoutingGroup}


#Loop through all Lync enabled users and look to see if they have a SIP: value in their ProxyAddresses (used in Outlook Web App Instant Messaging integration)
$i=0;Get-CSUser | %{ $strSam=$_.SamAccountName; $strSip=$_.SipAddress; $strName=$_.Name;$i++;

 If ((get-aduser -identity $strSam -properties proxyaddresses  | select proxyaddresses -ExpandProperty proxyaddresses | where {$_ -match “sip:”}).Count -ne 1) { 
  Write-host “WARNING: $i – $strSam – $strName – $strSip” -foregroundcolor DarkRed
 }

#Get AD Users with a surname of moore, and with and msRTCSIP-PrimaryUserAddress
get-aduser -ldapFilter {(&(objectClass=user)(msRTCSIP-PrimaryUserAddress=sip*)(sn=moore))} -properties *

#Forcefully Move steve to the Lync-Pool *NOTE* Steve might lose data if source pool is not available.
move-csuser sip:steve@contoso.com -verbose -Target lync-pool.contoso.org -Force -MoveConferenceData `$true

#Get all the users on the Lync-Pool
Get-CsUser -Filter {RegistrarPool -eq “Lync-Pool.contoso.org”}

#Get all Lync Users that are Enterprise Voice Enabled.
Get-CsUser -Filter {EnterpriseVoiceEnabled -eq $True}

#Get all Users on Lync-Pool or Lync-Pool2
Get-CsUser -Filter {RegistrarPool -eq “Lync-Pool.contoso.org” -or RegistrarPool -eq “Lync-Pool2.contoso.org”}

#Get all users from 3 pools and dump their data to a CSV for safe keeping.
Get-CsUser -Filter {RegistrarPool -eq “Lync-Pool.contoso.org” -or RegistrarPool -eq “Lync-Pool2.contoso.org” -or RegistrarPool -eq “sbs.contoso.org”} | Select Displayname,Sipaddress,RegistrarPool,LineURI,ClientPolicy,ConferencingPolicy,VoicePolicy,DialPlan | ConvertTo-Csv | Out-File c:\backups\Users.csv

#Get Pool Info for Stevem, tells me what Front End is currently his primary registar
Get-CsUserPoolInfo sip:stevem@contoso.com

Get-CsUserPoolInfo sip:stevem@contoso.com | Select-Object -Expand PrimaryPoolMachinesInPreferredOrder

Get-CsUserPoolInfo “Steve Moore” | Select-Object -Expand PrimaryPoolMachinesInPreferredOrder
Get-CsUser | Get-CsUserPoolInfo | Where-Object {$_.BackupPoolFqdn -eq $Null}
Get-CsUser | Get-CsUserPoolInfo | Where-Object {$_.PrimaryPoolFqdn -eq “redmond-cs-001.litwareinc.com”}
Get-CsUser | Get-CsUserPoolInfo | Where-Object {$_.PrimaryPoolFqdn -eq “se01.contoso.org”}
Get-CsUser | Get-CsUserPoolInfo | Where-Object {$_.PrimaryPoolFqdn -eq “se02.contoso.org”}
Get-CsUser | Where-Object {$_.RegistrarPool -ne $Null} | Get-CsUserPoolInfo
Get-CSUser -Identity “cathm@contoso.com” |fl > get-csuser.txt

Get-CsUser | Format-Table -Property DisplayName, SipAddress, EnterpriseVoiceEnabled -AutoSize
Get-CsUser | Format-Table -Property DisplayName, SipAddress, EnterpriseVoiceEnabled -AutoSize
Get-CsUser -Filter {VoicePolicy -ne $Null}
Get-CsUser -Filter {ClientPolicy -ne $Null}
Get-CsUser -Filter {ClientVersionPolicy -ne $Null}

Get-CsUser -Filter {VoicePolicy -eq $Null}
Get-CsUser -LdapFilter “Department=Finance”
Get-CsUser -LdapFilter “givenName=Steve”
Get-CsUser -LdapFilter “&(givenName=Stephen)(sn=Moore)”
Get-CsUser -LdapFilter “&(givenName=Steve)(surname=Moore)”
Get-CsUser -LdapFilter “&(Department=Finance)(Title=Manager)”
Get-CsUser -LdapFilter “|(Title=Supervisor)(Title=Manager)”

#Enable a Clark Kent on the Skype pool
Get-CSADUser -identity clark@contoso.org |Enable-CsUser -SipAddressType samaccountname -sipdomain contoso.com -registrarpool “skype.contoso.org”

#Create a new user Anakin Skywalker and create a photo in Active Directory for Anakin.
New-ADUser -SamAccountName anakin -Name “Anakin Skywalker” -AccountPassword (ConvertTo-SecureString -AsPlainText “Insta11Pwd” -Force) -Enabled $true -UserPrincipalName “anakin@contoso.org” -GivenName Anakin -Surname Skywalker -DisplayName “Anakin Skywalker (Contoso)” -PasswordNeverExpires $true
$photo = [byte[]](Get-Content C:\images\anakin.jpg -Encoding byte)
Set-ADUser anakin -Replace @{thumbnailPhoto=$photo}

#Find the Routing Group ID for Steve
Get-CSUser sip:stevem@contoso.com | %{$strRoutingGroup= $_.UserRoutingGroupID.ToString() -replace “-“,””;Write-Host $strRoutingGroup}

#See how all users in a SBA are tied together
Get-CsUser -Filter {RegistrarPool -eq “sbs.contoso.org”} |  %{$strRoutingGroup= $_.UserRoutingGroupID.ToString() -replace “-“,””;Write-Host $strRoutingGroup}


 

Active Directory

#Search for all contact objects with a surname like Moore.

get-adobject -filter {sn -like “moore*” -and objectclass -eq “contact”}

#Find Lync users who are not enabled in AD.

Get-CSUser -filter {enabled -eq $false} | %{$strSam=$_.SamAccountName;Get-ADuser -filter {SamAccountName -eq $strSam} | where {$_.Enabled -ne $false}}

#Check for users without a sip: entry in their ProxyAddresses attribute
$i=0;Get-CSUser | %{ $strSam=$_.SamAccountName; $strSip=$_.SipAddress; $strName=$_.Name;$i++;
 If ((get-aduser -identity $strSam -properties proxyaddresses  | select proxyaddresses -ExpandProperty proxyaddresses | where {$_ -match “sip:”}).Count -ne 1) { 
  Write-host “WARNING: $i – $strSam – $strName – $strSip” -foregroundcolor DarkRed
 }

#Get all the objects from Active Directory, in the config and the domain partitions.
ldifde -r “(objectClass=*)” -f config.ldf -p subtree -d “cn=configuration,dc=contoso,dc=org”
ldifde -r “(objectClass=*)” -f domain.ldf -p subtree -d “dc=contoso,dc=com”


 

General Commands

#Poor IT Pro’s Network Monitoring Tool  – Check to see if 5061, 443 or 3478 ports are being used.

while ($true){netstat -ano | findstr “506 443 3478”;sleep 5;cls}

#Poor IT Pro’s Network Monitoring Tool  – Check to see if 5061, 443 or 3478 ports are being used. Same thing, but this time logging to test.log

while ($true){netstat -ano | findstr “506 443 3478″|tee -a test.log;sleep 5;cls}

#Domain Admins who are Lync enabled

(Get-ADGroupMember “Domain Admins”).DistinguishedName | Get-CsUser -ErrorAction SilentlyContinue | Format-Table DisplayName,SipAddress

#have a look at versions of Skype or Lync installed on Lab1-fe1

Get-WmiObject -query ‘select * from win32_product’ | where {$_.name -like “Microsoft Lync Server*” -or $_.name -like “Skype for Business*”} -computername lab1-fe1

#Check if Receive Side Scaling is enabled.

Get-NetAdapterRss | Where-Object {$_.Enabled -eq $False}

#number of sockets (not Cores) on a FE box using Invoke-SQLCmd

Invoke-sqlcmd -query “select cpu_count from sys.dm_os_sys_info” -serverInstance “.\RTCLocal”

#Check how many Lync processes are running on a box?

get-process | where {$_.processname -match “ABServer|AcpMcuSvc|ASMCUSvc|AVMCUSvc|ChannelService|ClsAgent|ComplianceService|DataMCUSvc|DataProxy|FileTransferAgent|IMMCUSvc|LysSvc|MasterReplicatorAgent|MediaRelaySvc|MediationServerSvc|MRASSvc|OcsAppServerHost|ReplicaReplicatorAgent|ReplicationApp|RtcHost|RTCSrv|XmppProxy|XmppTGW”} | measure

#killing off a hung service
sc queryex “service name”

taskkill /f /pid 12345

#Disable a network interface
netsh interface set interface “Name of network card” disabled

#Run a couple of commands on a set of servers in servers.txt file. Uses sysinternals psexec
psexec @servers.txt  C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe “e:;cd e:\lync\scripts;.\get-dirstats.ps1 e:\lync\logs\iis\Internal;.\get-dirstats.ps1 e:\lync\logs\iis\External”

#Go through a directory and remove .new from files with that string in their name
dir | %{ $strNewFile=($_.name -replace “\.new”,””);rename $_.name $strNewFile}

#Remove blank lines from a file called file1 and save results in file2
cat .\File1.txt  |  where {$_ -ne $null -and $_ -ne “”} | out-file .\File2.txt

#Find all the computers in AD with a name like Lync, then list those servers that have a performance monitor user data collector set called “Lync Performance Monitoring”. Good for a validation check it has been setup.
Get-ADComputer -filter {name -like “*lync*”} | %{ $strServer =$_.DNSHostName;write-host $strServer;$intCount=(logman -s $strServer|where {$_ -match “Lync Performance Monitoring”}).Count;($intCount -eq 1)}

#Check all the computers in AD with a name like Lync and count the Lync services running on the box
Get-ADComputer -filter {name -like “*lync*”} | %{ $strServer =$_.DNSHostName;write-host $strServer;get-csWindowsService -ComputerName $StrServer|measure|select count|ft -auto}

#Install SQL Express (2012) Service Pack 2 and patch all the SQL Express instances on the box to SP2. Very worthwhile for Lync 2013 boxes.
SQLEXPR_x64_ENU.exe /ACTION=Patch /ALLINSTANCES /QS /HIDECONSOLE /IAcceptSQLServerLicenseTerms

#Silent install of Silverlight
Silverlight_x64.exe /q

#Silent install of OCS Reskit and Lync Debug tools
msiexec /i OCSReskit.msi /qb

msiexec /a LyncDebugTools.msi /qb

#Silent install of Netmon and the Lync and SQL Parsers
start /max /wait nm34_x64.exe /q
start /max /wait msiexec /i networkmonitor_parsers.x64.msi /qb
start /max /wait msiexec /i networkmonitor-lyncparsers-x64.msi /qb
start /max /wait msiexec /i networkmonitor_parsers_forSQLServer.msi /qb

#Silent install of a Cumulative Update *NOTE* the reboot, and that typically after a CU install database updates are required. So follow the CU doco to complete the install.
LyncServerUpdateInstaller.exe /silentmode /forcereboot

#Perform a network trace without installing sniffer software. *NOTE* Run the netsh trace stop when you want the trace to finish.
netsh trace start capture=yes persistent=no overwrite=yes scenario=NetConnection tracefile=c:\nettrace.etl fileMode=circular maxSize=400

netsh trace stop

#Run Lync/Skype bootstrapper from the command line
“%programfiles%\Microsoft Lync Server 2013\Deployment\bootstrapper.exe”
“%programfiles%\Skype for Business Server 2015\Deployment\Bootstrapper.exe”

#For all the servers in the Topology check their Get-CSWindowsService status
Get-CsManagementStoreReplicationStatus | select replicafqdn | foreach {$strServer=$_.replicafqdn;$strServer;Get-CSWindowsService -computername $strServer;}


 

#Run Lync/Skype Cumulative Update Installer (silently, NOTE may reboot)
LyncServerUpdateInstaller.exe /silentmode /forcereboot
SkypeServerUpdateInstaller.exe /silentmode /forcereboot

#Reset the Pool Registrar State
Reset-CsPoolRegistrarState -PoolFqdn “Lync-Pool.contoso.org” -ResetType ServiceReset -Confirm:$False

#Reset the Pool Registrar State when a Routing Group has only 1 member and needs to be hydrated from the database.
#This command is run regularly if servers in the pool are lost, or suffered an outage, and the routing groups need to be
#reassigned, hydrated from DB.

Reset-CsPoolRegistrarState -PoolFqdn “Lync-Pool.contoso.org” -ResetType QuorumLossRecovery -Confirm:$False

#Perform a full rest of the pool, WARNING: Generally this command should not be run!
Reset-CsPoolRegistrarState -PoolFqdn “Lync-Pool.contoso.org” -ResetType FullReset -Confirm:$False


 

#MBSA Scan Edge Servers- Please run a MBSA scan on the Edge. You can do it without installing MBSA
(but will need cabs and mbsacli.exe wusscan.dll copied to c:\lyncraas\mbsa). To run it use the following command
To run it use the following command (note we will need the MBSA cab files put in c:\lyncraas\mbsa\cabs folder and
the attached servers.txt file in the c:\lyncraas folder) – In a Command Prompt:
cd c:\mbsa
MBSACLI /xmlout /catalog c:\mbsa\cabs\wsusscn2.cab /unicode > c:\mbsa\edge.xml

#MBSA running collection across a list of servers (servers.txt) and save outputs to d:\mbsa
mbsacli.exe /nd /rd d:\mbsa /cabpath d:\mbsacab /listfile d:\servers.txt /offline /nvc /n OS+SQL+IIS+Password

Netmon Filters

#Filter out noise in Netmon
!(ipv6) And !(icmpv6) and !(Tcp.port == 3389) and !(udp.Port== 3389) and !(Tcp.port == 1494) and !(Tcp.port == 1503) and !(arp) and !(dhcpv6) and !(nbtns) and !(llmnr) and !(ssdp) and !(dhcp)  and !(WSDiscovery) and !(ipv4.Address==192.168.15.254)

#A couple of useful strings to search for in the property attribute
property.Description.contains(“SDP”)
property.Description.contains(“RT Audio”)
property.Description.contains(“Siren”)
property.Description.contains(“ClockRate: 16000”)
(property.Description.contains(“ICE 2.0”) or (property.Description.contains(“STUN:Binding Request”)

#Look for SIP traffic
tcp.SrcPort == 5061 or tcp.DstPort==5061 or tcp.SrcPort == 5068 or tcp.DstPort==5068 or tcp.SrcPort == 5060 or tcp.DstPort==5060 or property.Description.contains(“SIP:”)  

#SQL Traffic
tcp.srcPort == 1434 or tcp.DstPort == 1434 or udp.DstPort == 1434 or udp.SrcPort == 1434

#TURN requests
property.Description == “TURN:TURN:Allocate Request” OR
property.Description == “TURN:STUN:Binding Request” OR
property.Description == “TURN:STUN:Binding Response”

#Lync SMB requests
smb2 and Property.SMBFileName.contains(“centra”)
smb2 and Property.SMBFileName.contains(“CentralMgmt-1”)
smb2 and Property.SMBFileName.contains(“xds-master”)

Netstat

netstat -an |find /i “listening”
netstat -anob
netstat -ano |find “443”
netstat -ano |findstr 443

netstat -ano | findstr “199” | where {$_ -match “:5”} | where {$_ -match “UDP” -and $_ -notmatch “tcp”}
netstat -ano | findstr “199” | where {$_ -match “3478”} | measure

netstat -anob | findstr “443 506 3478”


 

NSLookup
Nslookup to see if the contoso Lync records are in order, against the 172.24.0.253 DNS Server.
nslookup lyncdiscover.contoso.com 172.24.0.253
nslookup lyncdiscoverinternal.contoso.com 172.24.0.253
nslookup av.contoso.com 172.24.0.253
nslookup sip.contoso.com 172.24.0.253
nslookup -type=all _sipfederationtls._tcp.contoso.com 172.24.0.253
nslookup -type=all _sip._tls.contoso.com 172.24.0.253

Check to see if DNS records for Lync are right internally, against the DC 192.168.1
nslookup lyncdiscover.contoso.com 192.168.15.1

nslookup lyncdiscoverinternal.contoso.com 192.168.15.1
nslookup av.contoso.com 192.168.15.1
nslookup sip.contoso.com 192.168.15.1
nslookup -type=all _sipfederationtls._tcp.contoso.com 192.168.15.1
nslookup -type=all _sip._tls.contoso.com 192.168.15.1


Install Pre-Requisites – Lync Server 2013

#look to see if .abs files are being generated…

dir \\fe01.contoso.org\lyncfileshare -recurse *abs | sort -property creationtime -Descending | select -first 5

Install Pre-Requisites – Skype for Business 2015

#look to see if .abs files are being generated…

dir \\fe01.contoso.org\lyncfileshare -recurse *abs | sort -property creationtime -Descending | select -first 5

Lync File Share

#look to see if .abs files are being generated…

dir \\fe01.contoso.org\lyncfileshare -recurse *abs | sort -property creationtime -Descending | select -first 5 

Certificates

#Import a PFX certificate into the Computer store

certutil -f -p P@ssw0rd -importPFX c:\skype.pfx

#List the Trusted Root Certificates on the machine
Get-Childitem cert:\LocalMachine\root -Recurse


 

VDI

#Create a Client Policy for VDI, and assign to batman
New-CsClientPolicy VDI -EnableMediaRedirection $True
Grant-CSClientPolicy -PolicyName VDI -Identity sip:batman@contoso.com


 

Event Logs

#Check for all DNS Server events on DC1 (except info) in the past 24 hours

$starttime=(get-date).addDays(-24)

#4 is info, 3 is warning
Get-WinEvent -computername dc1 -FilterHashTable @{logname=”DNS server”;starttime=$starttime;Level=1,2,3}

#Get events from the DC in the DNS Server event log, 4 is info, 3 is warning
Get-WinEvent -computername dc1 -FilterHashTable @{logname=”DNS server”;starttime=$starttime;Level=1,2,3,4}

#Search through events in a captured .evtx file for a server. Count the totals count of each event type that is an error.
$events = get-winevent -Path .\Contoso.lyncserver.Mon-18-08-2014.evtx | where {$_.level -eq 2 -or $_.level -eq 3}
$events | group id -noelement
$events | group id -noelement | sort -Property count -Descending

Skype Front End Patching
#Failover a computer for patching
Invoke-CsComputerFailOver -ComputerName “lab1-3-sf3.lab1.org” -Report “C:\Logs\SF3.html” -WaitTime 1:30:00

——————-

#Skype a Skype Pool
start-cspool -PoolFqdn skypepool2.lab1.org -Confirm:$False

DNS Commands

#Configure a server to Conditional Forward for a domain to a particular server.
Add-DnsServerConditionalForwarderZone lab1.org -MasterServers 192.168.15.11


 

Database Management

#Make svc_skype the db_owner of the XDS database
use xds
EXEC sp_addrolemember ‘db_owner’, ‘lab\svc_skype’;

#Make svc_skype the db_owner of the XDS database
Test-CsDatabase -ConfiguredDatabases -SqlServerFqdn (Get-CSService -UserDatabase).PoolFqdn | Select-Object DatabaseName,Installed*,Expected*

#Make svc_skype the db_owner of the XDS database
Install-CSDatabase -Update -CentralManagementDatabase -SqlServerFqdn lab1-1-fe1 -SqlInstanceName rtc


 

Install-csdatabase -CentralManagementDatabase -SqlServerFqdn LAB1-3-SQ1 -SqlInstanceName Skype

#on paired standard edition server that is backup cms
install-csdatabase -clean -CentralManagementDatabase -SqlServerFqdn lab1-1-fe1 -SqlInstanceName rtc

#Update the local SQL Express Databases
Install-CSDatabase -Update -LocalInstance -ForDefaultInstance


 

Enterprise Voice

#enabling SEFAUtil Application for Team Call and Group Call Pickup.

New-CsTrustedApplicationPool -Identity sfbcqd.contoso.org -Registrar Registrar:skype.contoso.org -Site Sydney -ComputerFqdn sfbcqd.contoso.org

New-CsTrustedApplication -ApplicationId SEFAUTIL -TrustedApplicationPoolFqdn sfbcqd.contoso.org -Port 6000

Enable-CsTopology

#Create a Call Park Orbit for Group Call Pickup

New-CsCallParkOrbit -Identity “Sydney” -NumberRangeStart “#100” -NumberRangeEnd “#199” -CallParkService skype.contoso.org -Type GroupPickup

#Assign Steve’s calls to use the Call Pickup Orbit #100 number. (works in conjunction with above command). Don’t forget using SEFAUTIL requires Lync/Skype core components + certificate installed (step 1 & 3 in deployment wizard).

SEFAUtil.exe stevem@contoso.com /Server:skype.contoso.org /enablegrouppickup:#100 /verbose

#Assign Leia’s calls to use the Call Pickup Orbit #100 number. (works in conjunction with Call Park cmdlet above).

SEFAUtil.exe leia@contoso.com /Server:skype.contoso.org /enablegrouppickup:#100 /verbose

#Check status of Steve’s Team Call and Group Pick up status

sefautil stevem@contoso.com /server:skype.contoso.org
User Aor: sip:stevem@contoso.com
Display Name: Steve Moore
UM Enabled: True
Simulring enabled: False
Delay Ringing Team (delay:5 seconds). Team: sip:wonderw@contoso.com sip:leia@contoso.com sip:batman@contoso.com
Group Pickup Orbit: sip:#100;phone-context=user-default@contoso.com;user=phone 

#Disable call forwarding for Leia
sefautil /server:skype.contoso.org sip:leia@contoso.com /disablefwdimmediate

#Disable Simultaneous Ring for Leia
sefautil /server:skype.contoso.org sip:leia@contoso.com /disablesimulring 

#Disable Team Call
sefautil stevem@contoso.com /server:skype.contoso.org /disableteamcall


 

Enterprise Voice – Call Park

#Turn on Call Park for the Global Voice Policy…

Set-CSVoicePolicy -Identity Global -EnableCallPark $true

#Set Call Park options for stevem and set the call pickup timeout to 59 seconds. (which seems a little much)

Set-CSCpsConfiguration -OnTimeoutURI sip:stevem@contoso.com -MaxCallPickupAttempts 1 -CallPickupTimeoutThreshold 00:00:59


 

Enterprise Voice – Call Admission Control

#Create a 0Kbps Audio and 0Kbps Video Bandwidth Policy

New-CsNetworkBandwidthPolicyProfile -Identity AllMediaBlocked -AudioBWLimit 0 -AudioBWSessionLimit 200 -VideoBWLimit 0 -VideoBWSessionLimit 3000

# Enable CAC to be turned on.

Set-CsNetworkConfiguration -EnableBandwidthPolicyCheck $true


 

Enterprise Voice – QoS

#Configure client settings for QoS to enable audio port range of 6000-6024, video port range 6025-6049, App Sharing 6050-6074, file transfer 6075-6099

Set-CsConferencingConfiguration -ClientMediaPortRangeEnabled $true -ClientAudioPort 6000 -ClientAudioPortRange 25 -ClientVideoPort 6025 -ClientVideoPortRange 25 -ClientAppSharingPort 6050 -ClientAppSharingPortRange 25 -ClientFileTransferPort 6075 -ClientFileTransferPortRange 25 

#Sets custom Conference Server ports for Conferencing Server (audio 40000-40332, video: 40333-40665, AppSharing: 40666-40998). *NOTE: Don’t do this without proper planning and testing. The range of ports all boils down to planned usage, and the change being made here is controlling the source ports used by the server!
Get-CsService -ConferencingServer | ForEach-Object {Set-CsConferenceServer -Identity $_.Identity -AppSharingPortStart 41000 -AppSharingPortCount 500 -AudioPortStart 40000 -AudioPortCount 500 –VideoPortStart 40500 -VideoPortCount 500

#Sets custom 1000 port range Conference Server ports for Application Server and Mediation Server (audio: 40000-40999, Video: 41000-41999, AppSharing: 42000-42999). *NOTE: Plan this change and make sure you have the right port ranges sufficient for your environment.
Get-CsService -ApplicationServer | ForEach-Object {Set-CsApplicationServer -Identity $_.Identity -AppSharingPortStart 42000 -AppSharingPortCount 1000 -AudioPortStart 40000 -AudioPortCount 1000 -VideoPortStart 41000 -VideoPortCount 1000
Get-CsService -MediationServer | ForEach-Object {Set-CsMediationServer -Identity $_.Identity -AppSharingPortStart 42000 -AppSharingPortCount 1000 -AudioPortStart 40000 -AudioPortCount 1000 -VideoPortStart 41000 -VideoPortCount 1000}
Get-CsService -ConferencingServer | ForEach-Object {Set-CsConferenceServer -Identity $_.Identity -AppSharingPortStart 42000 -AppSharingPortCount 1000 -AudioPortStart 40000 -AudioPortCount 1000 -VideoPortStart 41000 -VideoPortCount 1000}


 

Enterprise Voice – Unassigned Number Ranges

#Create a text to speech announcement to be used for unassigned numbers.
New-CsAnnouncement -Parent service:ApplicationServer:skype.contoso.org -Name “Welcome Announcement” -TextToSpeechPrompt “Thanks for ringing Contoso Australia. The number you have rung is not available. Please ring 0001 in the future.” -Language “en-AU”

#Set an unassigned number range for the organisation
New-CsUnassignedNumber -Identity “Contoso Unassigned Range” -NumberRangeStart “+61299990001” -NumberRangeEnd “+61299999999” -AnnouncementName “Welcome Announcement” -AnnouncementService ApplicationServer:skype.contoso.org

#Set the Contoso unassigned number range to play a .wav announcement when a call arrives for a phone number not currently issued to a staff member
Get-CsUnassignedNumber -Identity “Contoso Unassigned Range” | Set-CsUnassignedNumber -AnnouncementName “WAV Announcement” -AnnouncementService applicationserver:skype.contoso.org

#Set the Contoso unassigned number range to play a text to speech announcement
Get-CsUnassignedNumber -Identity “Unassigned Number Range Contoso” | Set-CsUnassignedNumber -AnnouncementName “Welcome Announcement” -AnnouncementService applicationserver:skype.contoso.org

#Using CQM to check the date format used in SQL – you can download CQM 1.5 here http://www.microsoft.com/en-us/download/details.aspx?id=46916
PS C:\cqm> .\GetSqlDateFormat.ps1

cmdlet GetSqlDateFormat.ps1 at command pipeline position 1
Supply values for the following parameters:
QoeInstance: sql01.contoso.org\lync
Use date format mm/dd/yyyy – an example is 12/31/2013

#Collect CQM data for 1st of November 2014 to 30th of November 2014. Save the data in the c:\CQM folder.
.\CQM.ps1 -StartTime 11-01-2014 -EndTime 11-30-2014 -QoeInstance sql01.contoso.org\lync -DataRoot c:\cqm -LyncVersion lync2013

#Collect CQM data with the 1.5 version of the CQM.ps1
.\CQM.ps1 -StartTime 01-11-2014 -EndTime 11-30-2014 -QoeCDRInstance sql01.contoso.org\lync -DataRoot c:\srm\cqm -QoECDRVersion lync2013

Enterprise Voice – Call Via Work

#generic call via work #
Set-CsRoutingConfiguration -CallViaWorkCallerId +61291616789

New-CsCallViaWorkPolicy -Identity Tag:ContosoUser1CvWP -Enabled $true -UseAdminCallbackNumber $true -AdminCallbackNumber +61291617789
Identity               : Tag:ContosoUser1CvWP
Enabled                : True
UseAdminCallbackNumber : True
AdminCallbackNumber    : +61291617789

Grant-CsCallViaWorkPolicy -Identity sip:aaronk@contoso.com -PolicyName Tag:ContosoUser1CvWP
Get-CsCallViaWorkPolicy -Identity Tag:ContosoUser1CvWP | Set-CsCallViaWorkPolicy -UseAdminCallbackNumber $False


 

Snooper Codes

#Edge AV Pool

<mediaRelayList>
<mediaRelay>
<location>internet</location>
<hostName>av.contoso.com</hostname>
<udpPort>3478</udpPort>
<tcpPort>443</tcpPort>
</mediaRelay>

#CAC QoE information about a call

VQReportEvent

#Redirect to home server

301 Redirect


 

Office Web App

#Go and check (with HTTP connection) all the Office Web App sites configured in the topology

$objTopo = Get-CSTopology
$objSites=$objTopo.Sites

$objNames=$objSites.Name

Foreach ($objName in $objNames) {

    write-host “Checking $Name”
    $objSite = $objSites | where {$_.Name -like “$objName”} | select-object -ExpandProperty Services | where {$_.RoleId -like “WacService*”}
    write-host $objSite.DiscoveryURL
    Invoke-WebRequest -Uri $objSite.DiscoveryURL | Select StatusCode,StatusDescription
    Write-host “——————————————-“
}


Comments (0)

Skip to main content