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-WCF-HTTP-Activation45, Web-Asp-Net45, Web-Mgmt-Tools, Web-Scripting-Tools, Web-Mgmt-Compat, Telnet-Client, Windows-Identity-Foundation, Server-Media-Foundation
Response Group Holiday Sets for New Zealand – 2017
#EDIT Below variables to match your environment
#######################################################
##Variables
$ServiceId = “service:UCFE01.ad.ucsorted.com” ##can be obtained from Get-CsService -ApplicationServer
$HolidaySets = @($NationalPublicHolidays, $AucklandAnniversary) #holiday sets to apply to the Workflows(comma seperated)
$RGSWorkflowName = “AKL Test” #Response group workflow to apply holiday to (can be obtained with Get-CsRgsWorkflow |ft name)
##CREATE HOLIDAYS
#National public holidays
$a = New-CsRgsHoliday -StartDate “01/01/2017 12:00 AM” -EndDate “02/01/2017 12:00 AM” -Name “2017 NZ New Years”
$b = New-CsRgsHoliday -StartDate “02/01/2017 12:00 AM” -EndDate “03/01/2017 12:00 AM” -Name “2017 NZ Day after New Years”
$c = New-CsRgsHoliday -StartDate “06/02/2017 12:00 AM” -EndDate “07/02/2017 12:00 AM” -Name “2017 NZ Waitangi Day”
$d = New-CsRgsHoliday -StartDate “14/04/2017 12:00 AM” -EndDate “15/04/2017 12:00 AM” -Name “2017 NZ Good Friday”
$e = New-CsRgsHoliday -StartDate “17/04/2017 12:00 AM” -EndDate “18/04/2017 12:00 AM” -Name “2017 NZ Easter Monday”
$f = New-CsRgsHoliday -StartDate “25/04/2017 12:00 AM” -EndDate “26/04/2017 12:00 AM” -Name “2017 NZ ANZAC Day”
$g = New-CsRgsHoliday -StartDate “05/06/2017 12:00 AM” -EndDate “06/06/2017 12:00 AM” -Name “2017 NZ Queens Birthday”
$h = New-CsRgsHoliday -StartDate “23/10/2017 12:00 AM” -EndDate “24/10/2017 12:00 AM” -Name “2017 NZ Labour Day”
$i = New-CsRgsHoliday -StartDate “25/12/2017 12:00 AM” -EndDate “26/12/2017 12:00 AM” -Name “2017 NZ Christmas Day”
$j = New-CsRgsHoliday -StartDate “26/12/2017 12:00 AM” -EndDate “27/12/2017 12:00 AM” -Name “2017 NZ Boxing Day”
#Regional public holidays
$Wellington = New-CsRgsHoliday -StartDate “23/01/2017 12:00 AM” -EndDate “24/01/2017 12:00 AM” -Name “2017 NZ Wellington Anniversary”
$Auckland = New-CsRgsHoliday -StartDate “30/01/2017 12:00 AM” -EndDate “31/01/2017 12:00 AM” -Name “2017 NZ Auckland Anniversary”
$Nelson = New-CsRgsHoliday -StartDate “30/01/2017 12:00 AM” -EndDate “31/01/2017 12:00 AM” -Name “2017 NZ Nelson Anniversary”
$Taranaki = New-CsRgsHoliday -StartDate “13/03/2017 12:00 AM” -EndDate “14/03/2017 12:00 AM” -Name “2017 NZ Taranaki Anniversary”
$Otago = New-CsRgsHoliday -StartDate “20/03/2017 12:00 AM” -EndDate “21/03/2017 12:00 AM” -Name “2017 NZ Otago Anniversary”
$Southland = New-CsRgsHoliday -StartDate “18/04/2017 12:00 AM” -EndDate “19/04/2017 12:00 AM” -Name “2017 NZ Southland Anniversary”
$CanterburySouth = New-CsRgsHoliday -StartDate “25/09/2017 12:00 AM” -EndDate “26/09/2017 12:00 AM” -Name “2017 NZ CanterburySouth Anniversary”
$HawkesBay = New-CsRgsHoliday -StartDate “20/10/2017 12:00 AM” -EndDate “21/10/2017 12:00 AM” -Name “2017 NZ HawkesBay Anniversary”
$Marlborough = New-CsRgsHoliday -StartDate “30/10/2017 12:00 AM” -EndDate “31/10/2017 12:00 AM” -Name “2017 NZ Marlborough Anniversary”
$Cantebury = New-CsRgsHoliday -StartDate “17/11/2017 12:00 AM” -EndDate “17/11/2017 12:00 AM” -Name “2017 NZ Canterbury Anniversary”
$ChathamIslands = New-CsRgsHoliday -StartDate “27/11/2017 12:00 AM” -EndDate “27/11/2017 12:00 AM” -Name “2017 NZ ChathamIslands Anniversary”
$Westland = New-CsRgsHoliday -StartDate “04/12/2017 12:00 AM” -EndDate “05/12/2017 12:00 AM” -Name “2017 NZ Westland Anniversary”
#Create national public holiday date sets
$NationalPublicHolidays = New-CsRgsHolidaySet -Parent $ServiceId -Name “2017 NZ Holidays” -HolidayList ($a, $b, $c, $d, $e, $f, $g, $h, $i, $j)
#Create regional public holiday date sets
$AucklandAnniversary = New-CsRgsHolidaySet -Parent $ServiceId -Name “2017 NZ Auckland Anniversary Day” -HolidayList ($Auckland)
$TaranakiAnniversary = New-CsRgsHolidaySet -Parent
WAC Server PreRequisites
Windows 2012 R2
Add-WindowsFeature Web-Server,Web-Mgmt-Tools,Web-Mgmt-Console,Web-WebServer,Web-Common-Http,Web-Default-Doc,Web-Static-Content,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Security,Web-Filtering,Web-Windows-Auth,Web-App-Dev,Web-Net-Ext45,Web-Asp-Net45,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Includes,InkandHandwritingServices
Populate AD Telehone Number from Skype LineURI
Often I need to populate the AD Telephone Number from the LineURI. Although there are a number of blogs describing this process, if you know me..keep it simple, right?
So here is my KISS (Keep It Simple Stupid) method:-
# Collect LineURI for Users
$LineURIUsers = Get-Csuser -Filter { LineURI -ne $Null } | Select-Object LineURI, SamAccountName
foreach ($user in $LineURIUsers)
{
$LineURI = $user.LineUri
# Format the Line URI to something more acceptable in AD. Removing the Tel: (and other variants of this) and replacing ;ext= with a x
$LineURI = $LineURI.trim(“tel:”)
$LineURI = $LineURI.trim(“TEL:”)
$LineURI = $LineURI.trim(“Tel:”)
$LineURI = $LineURI -replace “;ext=”, ” x”
#Set the AD Telephone Number from the results above
Write-Host “Setting Telephone Number for user “ $user.SamAccountName “to “ $LineURI
Set-ADUser $user.SamAccountName -OfficePhone $LineURI;
}
$count = $LineURIUsers | Measure-Object | Select-Object -expand count
Write-Host “`n”
Write-Host “A total of “ $count “AD Users have been updated”
$NoLineURIUsers = Get-Csuser -Filter { EnterpriseVoiceEnabled -eq $true -and LineURI -eq $Null } | Select-Object SamAccountName
$count = $NoLineURIUsers | Measure-Object | Select-Object -expand count
Write-Host “`n”
Write-Host “A total of” $count “AD Users do not have a LineURI set,but are Enterprise Voice Enabled”
Write-Host “`n”
Write-Host “These are as follows:- `n”
foreach ($user in $NoLineURIUsers)
{
Write-Host $user.SamAccountName
}
SCRIPT: Enable Skype for Business users for Hosted UM
This script gets all the users that are Enterprise Voice Enabled. It then feeds the SIP address of each of these users to the foreach loop, effectively granting the HostedVoiceMailPolicy and setting HostedVoiceMail to True
#Variables
$hostedVMPolicy = “CloudUM” #rename to match your HostedVoiceMailPolicy
$userlist = get-csuser | where{ $_.enterprisevoiceenabled -eq “true” }
foreach ($user in $userlist)
{
Write-Host “Granting Hosted VoiceMail Policy to” $user.sipaddress
Grant-CsHostedVoicemailPolicy $user.sipaddress -policyname $hostedVMPolicy
set-csuser $user.sipaddress -HostedVoiceMail $true
}
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
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
}
Running Lync Server Management Shell Remotely
Based on http://blogs.technet.com/b/nexthop/archive/2010/06/16/qsremoteaccess.aspx
First you will need to create a powershell script, next we will create a shortcut that runs the powershell script.
I use the following details in my script:-
******************************************************************************************************
Param (
[switch] $AuthenticationPrompt = $false,
[string] $AdminUsername = “domain\username”
)
$Error.Clear()
If ($AuthenticationPrompt) {
Write-Host -ForegroundColor Green “Requesting Credentials for Lync Server Administrative Session”
$CSSession = New-PSSession -ConnectionUri https://<FrontEnd Pool FQDN>/ocspowershell -Credential $AdminUsername -ErrorAction SilentlyContinue
}
else
{
$CSSession = New-PSSession -ConnectionUri https://<FrontEnd Pool FQDN>/ocspowershell -Authentication NegotiateWithImplicitCredential -ErrorAction SilentlyContinue
}
If ($Error.count -gt 0)
{
Write-Host -ForegroundColor Red “Unable to Connect to Lync Server Administrative Session`n Error:” $Error
}
else
{
$ImportResults = Import-PSSession -Session $CSSession
Write-Host -ForegroundColor Green “Connected to Lync Server Administrative Session`nImported” $ImportResults.ExportedFunctions.count “CS Functions”
}
cd $env:UserProfile
******************************************************************************************************
Substitute the AdminUsername to that of your admin account that has the correct RBAC
Data Collection for As Built dumped to CSV
This is really a data collection exercise I use to collect the Lync config and ship off site to include into the AsBuilt documentation.
########################################################################
# Author: Paul B
# Purpose: Script to Dump Lync Config for As Build Documentation
# Version: 1.0
# 02/01/2013 – Release 1.0
#Change
# Instructions
# Edit the below variables to match your requirements
#
########################################################################
Get-CsVoiceNormalizationRule | Export-Csv c:\PB\normalrules.csv
Get-CsRoutingConfiguration | Export-Csv c:\PB\routes.csv
Get-CsVoicePolicy | Export-Csv c:\PB\voicepolicy.csv
Get-CsTrunkConfiguration | Export-Csv c:\PB\Trunkconf.csv
Get-CsPstnUsage | Export-Csv c:\PB\PSTNUsage.csv
Get-CsUnassignedNumber | Export-Csv c:\PB\UnAssignedNumbers.csv
Get-CsAnnouncement | Export-Csv c:\PB\UnAssignedAnnouncement.csv
Get-CsConferencingPolicy | Export-csv c:\PB\confpol.csv
Get-CsExternalAccessPolicy| export-csv c:\PB\externalpol.csv
Get-CsClientPolicy | export-csv c:\PB\clientpol.csv
Get-CsRgsAgentGroup | export-csv c:\PB\RGSAgentGroup.csv
Get-CsRgsQueue | export-csv c:\PB\RGSQueue.csv
Get-CsRgsWorkflow | export-csv c:\PB\RGSWorkFlow.csv
Get-CsRgsWorkflow | select-object Identity | Export-Csv c:\PB\RGSConfiguration.csv
Get-CsRgsHolidaySet | export-csv c:\PB\RGSHolidayset.csv
Get-CsRgsHoursOfBusiness | export-csv c:\PB\RGSHoursOfBusiness.csv
Get-CsAccessEdgeConfiguration | export-csv c:\PB\AccessEdgeConfig.csv
Get-CsAllowedDomain | export-csv c:\PB\FederationAllowedDomains.csv
Get-CsBlockedDomain | export-csv c:\PB\FederationBlockedDomains.csv
Get-CsCallParkOrbit | export-csv c:\PB\CallPark.csv
Get-CsCdrConfiguration | export-csv c:\PB\CDRConfig.csv