$usercredential= get-credential
$lyncsession = new-pssession -connectionuri /ocspowershell -credential $usercredential
Import-PSSession $lyncsession
Write-EventLog -LogName "Lync Server" -Source "LS Protocol Stack" -EntryType Information - EventId Message “Your Message Text Here”
Edge server certificate stores are filling up on Lync 2010 Edges (Server 2008 R2) When this happens service availability is impacted Need a method to monitor this with SCOM Note – this can be done from within Lync in 2013
$regkeycount = get-childitem -Path 'HKLM:\software\Microsoft\Cryptography\Services\ RtcSrv\SystemCertificates\Accepted Certificates' | Where-Object -FilterScript {($_.Name -eq "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ Cryptography\Services\RtcSrv\SystemCertificates\ Accepted Certificates\Certificates")}
$EventMessage = "There are " +$regkeycount.SubKeyCount+ " certificates in the Accepted Store.” Blue font represents text, red represents variables
if ($regkeycount.SubKeyCount -lt 299) { Write Informational Message } Else if ($regkeycount.SubKeyCount -lt 399) { Write Warning Message } Else { Write Error Message } Replace blue text with script blocks containing actual Write-EventLog syntax from next 3 slides
if ($regkeycount.SubKeyCount -lt 299) { Write-EventLog -LogName "Lync Server" -Source "LS Protocol Stack" -EntryType Information - EventId Message $EventMessage } Assumes $EventMessage is error or information captured from command output
elseif ($regkeycount.SubKeyCount -lt 399) { Write-EventLog -LogName "Lync Server" -Source "LS Protocol Stack" -EntryType Warning -EventId Message $EventMessage } Assumes $EventMessage is error or information captured from command output
Write-EventLog -LogName "Lync Server" -Source "LS Protocol Stack" -EntryType Error -EventId Message $EventMessage Assumes $EventMessage is error or information captured from command output
#Counts certificates in Accepted Certificates store and writes to event log $regkeycount = get-childitem -Path 'HKLM:\software\Microsoft\Cryptography\Services\RtcSrv\SystemCertificates\Accepted Certificates' | Where-Object - FilterScript {($_.Name -eq "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Services\RtcSrv\SystemCertificates\Accepted Certificates\Certificates")} if ($regkeycount.SubKeyCount -lt 299) { $EventMessage = "There are " +$regkeycount.SubKeyCount+ " certificates in the Accepted Store. No action is needed." Write-EventLog -LogName "Lync Server" -Source "LS Protocol Stack" -EntryType Information -EventId Message $EventMessage } elseif ($regkeycount.SubKeyCount -lt 399) { $EventMessage = "There are " +$regkeycount.SubKeyCount+ " certificates in the Accepted Store. This number is high." Write-EventLog -LogName "Lync Server" -Source "LS Protocol Stack" -EntryType Warning -EventId Message $EventMessage } else { $EventMessage = "There are " +$regkeycount.SubKeyCount+ " certificates in the Accepted Store. Please clear the store." Write-EventLog -LogName "Lync Server" -Source "LS Protocol Stack" -EntryType Error -EventId Message $EventMessage }
Organization is moving to closed federation model Large number of requests are expected to add partner domains Need automated method based on output from SharePoint (coming in CSV)
#Get Path and FileName [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") $ofd = New-Object System.Windows.Forms.OpenFileDialog # $ofd.InitialDirectory = $(pwd).path $ofd.InitialDirectory = (Split-Path -Path $MyInvocation.MyCommand.Definition - Parent) #Replace the text in quotes with instructions for the user on what file to select $ofd.title = "Select the CSV containing the list of federated peers" $ofd.ShowHelp=$true if($ofd.ShowDialog() -eq "OK") { $ofd.FileName } $FileName = $ofd.FileName
$Feds = import-csv $FileName $transcriptname = "AddNewFederationPartners_" + (Get-Date -Format s).Replace(":","-") +".txt" Start-Transcript $transcriptname
foreach ($F in $Feds) { new-csalloweddomain -domain $F.Domain - ProxyFQDN $F.Gateway -comment $F.Comment - verbose } stop-transcript
#Import-Module Lync #Get Path and FileName [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") $ofd = New-Object System.Windows.Forms.OpenFileDialog # $ofd.InitialDirectory = $(pwd).path $ofd.InitialDirectory = (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent) #Replace the text in quotes with instructions for the user on what file to select $ofd.title = "Select the CSV containing the list of federated peers" $ofd.ShowHelp=$true if($ofd.ShowDialog() -eq "OK") { $ofd.FileName } $FileName = $ofd.FileName $Feds = import-csv $ofd.FileName $transcriptname = "AddNewFederationPartners_" + (Get-Date -Format s).Replace(":","-") +".txt" Start-Transcript $transcriptname foreach ($F in $Feds) { new-csalloweddomain -domain $F.Domain -ProxyFQDN $F.Gateway -comment $F.Comment -verbose } stop-transcript