10 April 2014

Find All Assigned Numbers

Find All Assigned Numbers


Get-CsUser -Filter {LineURI -ne $Null}
Get-CsUser -Filter {PrivateLine -ne $Null}
Get-CsAnalogDevice -Filter {LineURI -ne $Null}
Get-CsCommonAreaPhone -Filter {LineURI -ne $Null}
Get-CsExUmContact -Filter {LineURI -ne $Null}
Get-CsDialInConferencingAccessNumber -Filter {LineURI -ne $Null}
Get-CsTrustedApplicationEndpoint -Filter {LineURI -ne $Null}
Get-CsRgsWorkflow
Get-CsMeetingRoom -Filter {LineURI -ne $Null}

25 September 2013

Find a specific TelURI assignment

At times you may lose track of who has been assigned which Tel URI. Although its easy enough to grab a csv of all csusers or even dump to an html file, that is a larger hammer than is required.

A simple Lync Management Shell Script does the job:


Get-CsUser | where {$_.LineURI -eq "tel:+649xxxxxxx" -or $_.PrivateLine -eq "tel:+649xxxxxxx"} | format-table -property DisplayName,LineURI,PrivateLine

The result:



Granted you can search and filter from Lync Control Panel for Tel Uri, there is no way of finding Private Line URI's from the Control Panel

5 September 2013

Switching RGS Audio files

This script was created to allow a customer to quickly change the audio file (MOH) used by the RGS workflow. The idea was for an IT Service Desk that would announce known outages etc by means of their queue music. They would have a list of pre-recorded audio files and by means of the script simply select the file they wanted to use. OF course the use case can be anything really, sales specials, marketing pitch etc.

Download

4 September 2013

Lync Prerequisite install Script

Although I have blogged this before, I decided it needs to live here with all the other PS related stuff. So here it is.

Installing all the Windows prerequisites can be time consuming if done from Server Manager, this is way faster and doesn't make any errors ;-)

#Windows 2008 R2
Import-Module ServerManager

Add-WindowsFeature RSAT-ADDS, Web-Server, Web-Static-Content, Web-Default-Doc, Web-Http-Errors, Web-Asp-Net, Web-Net-Ext, Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Http-Logging, Web-Log-Libraries, Web-Request-Monitor, Web-Http-Tracing, Web-Basic-Auth, Web-Windows-Auth, Web-Client-Auth, Web-Filtering, Web-Stat-Compression, Web-Dyn-Compression, NET-HTTP-Activation, Web-Asp-Net, Web-Mgmt-Tools, Web-Scripting-Tools, Web-Mgmt-Compat, Telnet-Client, BITS, Desktop-Experience

#Windows 2012 -  Requires access to the ISO, below assumes Lync iso is on E:\

Install-WindowsFeature RSAT-ADDS,Web-Server,Web-Static-Content,Web-Default-Doc,Web-Http-Errors,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Basic-Auth,Web-Windows-Auth,Web-Client-Auth,Web-Filtering,Web-Stat-Compression,Web-Dyn-Compression,NET-WCF-HTTP-Activation45,Web-Asp-Net45,Web-Mgmt-Tools,Web-Scripting-Tools,Web-Mgmt-Compat,NET-Framework-Core,NET-HTTP-Activation,Desktop-Experience,Windows-Identity-Foundation,Telnet-Client,BITS -Source E:\sources\sxs

Move All OCS Users Homed on a Specific Pool to Lync

The below example is really just a one liner, but useful enough to be awarded its own post.

It Move All OCS Users Homed on a Specific Pool to Lync as well as sets conferencing policy and external access policy to automatic, rather than the legacy migrated OCS policies. 

NOTE Replace items in bold with your details as required

get-csuser -OnOfficeCommunicationServer | Where {$_.HomeServer -eq "CN=Users,CN=Auckland,CN=OCSPoolName,CN=Pools,CN=RTC Service,CN=Services,CN=Configuration,DC=LyncLab,DC=co,DC=nz"} | Move-CsLegacyUser -Target LyncPoolFQDN -ExcludeConferencingPolicy -ExcludeExternalAccessPolicy -Confirm:$FALSE

Set TelURI from AD Office Phone

For this one you need to have RSAT (Remote Server Administration Tools) installed
You could install that with the following line:
Add-WindowsFeature RSAT-AD-Powershell

#Importing the AD Module

Import-Module ActiveDirectory

#Collect all the Lync users and store as a variable $users = Get-CSUser

#The foreach loop Foreach ($user in $users)
{
   $Tel = $user.LineURI
   $Tel = $Tel.Replace("tel:", "")
   If ($Tel -ne "")
   {
      Set-ADUser -Identity $user.SAMAccountName -OfficePhone $Tel
   }
}

Change SIP domain for all users

It isn't everyday that you come across this but since many make the mistake of using their AD Domain name as their SIP domain, it does certainly come up.

Just remember that you will already have added the new SIP domain to the topology, all certificates sorted etc.

# Collect all the users and store as a variable
$Users = Get-CsUser

#The foreach loop
#Edit the bold bits to match your requirements

foreach ($User in $Users)
{
   $oldSIPDomain = $User.SipAddress
   $newSIPDomain = $oldSIPDomain -replace "@oldsipdomain.com", "@newsipdomain.com"
   Set-CsUser -Identity $User.Identity -SipAddress $newAddress
}