Hyper-V 2012 R2- Replica Email Notification Script

Here is an example Hyper-V replica email notification script. Scenario is Hyper-V cluster replicating business critical VMs to a single Hyper-V host. The script can be ran as a scheduled task on the DR Hyper-V host to send email notifications. The account running the script must have Hyper-V permissions. Script: Hyper-V 2012 Replica Email Script # Created by Chris Hayward # Purpose - To send a daily email displaying Hyper-V Replica status # Version 1.0 # Get date in UK format day/month/year $date = Get-Date -Format dd/MM/yy # Variables $MailFrom = 'hyperv_replica@yourdomain.com' $MailTo = 'you@yourdomain.com' $MailSubject = "Hyper-V Replica Report $date" $MailServer = 'smtp.yourdomain.coml' # Get replication status in HTML format $status = Get-VMReplication | Select-Object Name, State, Health, Mode, FrequencySec, PrimaryServer, ReplicaServer, ReplicaPort | ConvertTo-Html # Send email message Send-MailMessage -From $MailFrom -To $MailTo -Subject $MailSubject -BodyAsHtml -Body "$status" -SmtpServer $MailServer Example output: ...

17 November 2015 · 1 min · Chris Hayward

Skype for Business – Central Management Backup Module Failed

I recently deployed Skype for Business 2015 standard edition pool pairing. The CMS was originally on a Lync 2010 Standard edition server and was moved over to a Skype4B Pool1 when Lync was decommissioned. Skype4B Pool2 (FE2) was logging the following event IDs every few minutes: Error1 Event ID 4082, LS Backup Service Skype for Business Server 2015, Backup Service central management backup module failed to complete import operation. Configurations: Backup Module Identity:CentralMgmt.CMSMaster Working Directory path:\\FRONTEND.domain\SfBFileShare$\3-BackupService-2\BackupStore\Temp Local File Store Unc path:\\FRONTEND.domain\SfBFileShare$\3-BackupService-2\BackupStore Remote File Store Unc path:\\FRONTEND.domain\SfBFileShare$\2-BackupService-3\BackupStore Additional Message: Exception: Microsoft.Rtc.BackupService.ImportOperationException: Import operation (from zip archive \\FRONTEND.domain\SfBFileShare$\3-BackupService-2\BackupStore\CentralMgmt\CMSMaster\Data\Backup.zip) is failed due to: Failed to execute stored procedure XdsUpdateReplicaData. Native Error: 2000, Exception: Database layer is not in acquired state. Retriable: False. Cookie: <repl:Status xmlns:repl="urn:schema:Microsoft.Rtc.Management.Xds.ReplLayer.2008"><repl:Batch xmlns:repl="urn:schema:Microsoft.Rtc.Management.Xds.ReplLayer.2008" Id="2cb13a5a-81ad-47f0-9162-5de8af04d85b" FullVersion="1" PartialVersion="248" /><repl:Batch xmlns:repl="urn:schema:Microsoft.Rtc.Management.Xds.ReplLayer.2008" Id="b6a684fe-9989-4659-bffa-9f15eb07a7df" FullVersion="1" PartialVersion="6" /></repl:Status>. ---> Microsoft.Rtc.Common.Data.SqlConnectionException: Database layer is not in acquired state --- End of inner exception stack trace --- at Microsoft.Rtc.BackupService.BackupModules.XdsBackupModuleBase.UpdateBackupClusterInSingleTransaction(Unzipper unzipper, String newCookie) at Microsoft.Rtc.BackupService.BackupModules.CentralMgmtBackupModule.ApplyChanges(Unzipper unzipper, String& newCookie, Boolean& forceSetErrorState) at Microsoft.Rtc.BackupService.BackupModuleHandler.ReceiveBackupDataTask.ApplyChanges(Boolean& forceSetErrorState) at Microsoft.Rtc.BackupService.BackupModuleHandler.ReceiveBackupDataTask.InternalExecute() at Microsoft.Rtc.Common.TaskManager`1.ExecuteTask(Object state) Cause: Either network or permission issues. Please look through the exception details for more information. Resolution: Resolution Error2 ...

18 September 2015 · 2 min · Chris Hayward

Skype for Business (Lync) – Easiest way to add trusted root certificate authorities to Edge

Ok here is a little tip when trying to add trusted root certificate authorities to Skype for Business 2015 and Lync 2010/2013 Edge servers. Microsoft have a list of Unified Communications Certificate Providers detailed here: https://support.microsoft.com/en-us/kb/929395 Windows now automatically downloads Trusted Root certificates when you access a web page on HTTPS. We can exploit this to get all Trusted Root certificates on our Edge servers which is required for Federation to work correctly. An example of this is where you only get one way IM or a federated partner may see your presence as unknown. ...

17 September 2015 · 2 min · Chris Hayward

Windows Server 2012 R2 – Add cluster node / Cluster Service "Keyset does not exist"

I recently came across an error where the Cluster Service stopped on a Windows Server 2012 R2 failover cluster and would not start. Event Logs generated were: Event ID: 7024 The Cluster Service service terminated with the following service-specific error: Keyset does not exist Event ID: 7031 The Cluster Service service terminated unexpectedly. It has done this 282 time(s). The following corrective action will be taken in 60000 milliseconds: Restart the service. ...

2 July 2015 · 2 min · Chris Hayward

Lync – Page file causes Front End to run out of disk space (sqlservr.exe and pagefile)

I have recently encountered a strange issue where all 3 Front End servers in the same pool ran out of disk space at the same time. When investigating both sqlservr.exe processes (RTCLOCAL and LYNCLOCAL) were consuming the whole page file (or all of the available space on C: as the pagefile was system managed). In Resource Monitor I could see the commit for both sqlservr.exe processes was extremely high. Apologies for the poor images, I was using iMessage to send the images to a colleague and didn’t screenshot: ...

17 April 2015 · 2 min · Chris Hayward

SCCM – 2012 R2 Client won't install or uninstall

I recently came across an issue where the SCCM 2012 R2 Client would not install on one machine (OS Server 2012 R2). The machine had previously had a working SCCM client that was updated to CU4. The Configuration Manager icon in Control Panel was still visible, but when opening it all of the values were blank. I was also unable to uninstall the client using ccmsetup.exe /uninstall. Forcing an install from the SCCM Console and selecting uninstall previous SCCM clients also did not work. ...

17 April 2015 · 1 min · Chris Hayward

Lync – Move On Prem users to Lync Online from CSV

Microsoft detail how to move users from Lync On-Prem to Lync Online and how to bulk move users in an OU or with a particular AD attribute: https://technet.microsoft.com/en-us/library/jj204969%28v=ocs.15%29.aspx?f=255&MSPPError=-2147217396. If you want to bulk move users to Lync Online from a CSV you can use the PowerShell below: $creds=Get-Credential Import-Csv movelyncusers.csv -Header Identity | Foreach-Object {Move-CsUser -Identity $_.identity -Target sipfed.online.lync.com -Credential $creds -HostedMigrationOverrideUrl https://admin1e.online.lync.com/HostedMigration/hostedmigrationService.svc} movelyncusers.csv should contain a list of the UPNs of the users you wish to move. No headings are required.

17 April 2015 · 1 min · Chris Hayward

Lync – Office 365 Federation Presence Unknown

A customer was having problems with their Lync 2010 deployment federating with Office 365. When searching for a Lync Online user they would see “Presence Unknown” and be unable to send Instant Messages. They could Federate with other On-Prem Lync organisations OK. They had LyncOnline configured as a Hosted Provider and Partner Domain Discovery Enabled (Dynamic Federation). Their _sipfederationtls._tcp DNS record was configured correctly as was the O365 customer. Using OCSLogger and Snooper on the Edge server I was able to spot the problem. ...

2 April 2015 · 2 min · Chris Hayward

Lync – Unable to sign in via Edge (Checkpoint Firewalls)

I recently ran into a problem with Checkpoint Firewalls on a Lync 2010 deployment. The customer already had a single 2010 Front End and wished to enable external sign in over the internet as it did not work over their VPN solution (Direct Access). I installed the Edge server and Reverse Proxy but then encountered a strange issue where I was unable to sign in over the Edge server. Some of the troubleshooting steps I took (Thinking it was my fault): ...

24 March 2015 · 3 min · Chris Hayward

Lync – UK +44 (0) Company_Phone_Number_Normalization_Rules.txt

A common problem in the UK is that companies Active Directory telephone numbers will be populated in the format: +44 (0) 123 456 7891 or +44(0)1234567891 If you were to dial these numbers in the UK you would omit the +44 and just dial the 0. If you are abroad you would dial +44 and omit the 0 (E164 format). As part of the default Lync normalization rules it will remove all spaces and brackets (). When using Lync click to call from a users contact card this normalizes the number to +4401234567891 which is invalid. Therefore you need to either correct all numbers in AD to E164 format or add a normalization rule to the Company_Phone_Number_Normalization_Rules.txt file on your Lync File Share. This is already well documented here: ...

18 November 2014 · 1 min · Chris Hayward