Register SCOM MG to OMS using PowerShell

June 13th, 2016

System Center Advisor “OMS” offers multiple cmdlets , the full list of cmdlets could be found here

Last week I was working  with one my customers to register his SCOM Management Group to OMS, Due to the security restrictions we couldn’t register the Management Group via the Wizard. our last option was to use PowerShell  , the cmdlet to register a Management Group is   Register-SCAdvisor. The cmdlet requires a certificate in a PFX. don’t try to generate a certificate from your Azure portal , it is not going to work.  this is how to get the PFX

login to your OMS Subscription once you see the main dashboard in the URL replace what after the in the URL bar with the following DownloadCertificate.ashx

so the URL will be

In my case my workspace name is ContosoIG the URL will be
and hit enter

Before :-


After:- image

Save the cert in your SCOM management Server (i.e. C:\temp)

In SCOM PowerShell Console Type the following  
Register-SCAdvisor –CertificatePath  "C:\temp\RegistrationCert.pfx"


The cmdlets returns True if it succeeded

Read-Only User Role Introduced in OMS Log Analytics

May 11th, 2016


Today  OMS PG introduced read-only” user role in OMS Log Analytics.

Users marked as read-only will not be able to:

1. Add\remove solutions (solution gallery hidden)
2. Add\modify\remove ‘My Dashboards’
3. Setting page is hidden
4. In the Search view, PowerBI configuration, Saved Searches and Alerts tabs are hidden

Using OMS Search API to create 100’s of queries in 2 min

April 13th, 2016

OMS log analytics allows you to save your preferred search queries and organize them under categories .  All what you need is to figure out your search query then click save button in the Search bar  then enter the Name and Category then hit save.  How about if you have 100 of queries that you need to save in OMS ?


In this blog I will show you how to upload hundreds of queries saved in csv file to OMS using PowerShell and the latest OMS API.  before you start please read Tiander Turpijn blog this will give you good understanding about OMS API and the prerequisites to use OMS PowerShell cmdlets.

In my example I have used the Service Principal to login and authenticate to my OMS workspace instead of typing my user name and password . if you need to know more how to create Service principal name , please read Tom FitzMacken’s blog

First let’s prepare the CSV file that will have the queries in excel type the following as a header: SavedSearchId, DisplayName, Category, Query

Your Excel Sheet will look similar to the following:  image Column D is the concatenation of   Colum E, F and G

then copy Column D and paste in the same place  (select Paste Value) then delete Column E,F and G.
your Excel Sheet will look similar to the following: 
imageimageSave the file as CSV “OMSQueries.CSV”

PowerShell Time:

Line 8 to 11 : this is where I connect prepare the credential to connect as the service principal name.

Line 16 and 18: Initialize the variable for the Resource Group containing the workspace name you can get this information from your azure portal


Line 20: Identify the Search version for log analytics , in the MSDN it says not required, however I verified and it is required otherwise you will receive an error (Thanks to Tiander Turpijn  and Jim Britt )

   1: <;#

   2:     Author :Islam Gomaa 

   3:     Purpose :save bulk queries in OMS Saved searched 

   4:     Date :- April 13th 2016

   5:     Reference : -

   6: #>;


   8: $SecPasswd = ConvertTo-SecureString "qg1t491LBlye6nkJupST54iEoxCHu1KuPhS1T/6N4OG=" -AsPlainText -Force

   9: $UserName= "2FF75X4G-6179-3067-358d-3d269df0f57a" # Client ID

  10: $TenantId ="dd9ed1c8-6445-68c3-as3c-72b00s45b45f"

  11: $Creds = New-Object System.Management.Automation.PSCredential($UserName, $SecPasswd)



  14: Login-AzureRmAccount -ServicePrincipal -TenantId $TenantId -Credential $Creds >;$null


  16: $OIRessourceGroup= "RG-Azure1"


  18: $OIWorkspace = "ContosoIG"


  20: $version =1 


  22: $CSVFile = Import-Csv C:\Users\isgomaa\OneDrive\Desktop\OMSQueries.csv

  23: $FileLenth = $CSVFile.Length



  26: for ($i=0; $i-lt $CSVFile.Count-1 ;$i++)

  27: { 

  28:    $SavedSearchId = $CSVFile[$i].SavedSearchId

  29:    $DisplayName = $CSVFile[$i].DisplayName

  30:    $Category= $CSVFile[$i].Category

  31:    $Query= $CSVFile[$i].Query

  32:    Set-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $OIRessourceGroup -WorkspaceName $OIWorkspace `

  33:                                           -SavedSearchId $SavedSearchId -DisplayName $DisplayName `

  34:                                           -Category $Category  -Query $Query -Version $version


  36: }

Line 22 : read the file and store it in an array

From line 26 to the end of the script looping in the array and creating the Queries in OMS

The Final result on PowerShell ISE


The Final result when you login to OMS 



Islam G.

Update Rollup 8 for System Center 2012 R2 Data Protection Manager is now available

October 29th, 2015


Download from
Issues that are fixed in this update rollup


Data Protection Manager
  • The DPM Agent crashes intermittently during a backup.
  • If you are trying to recover data from an imported tape, DPM may crash with a "Connection to the DPM service has been lost" error.
  • If you try to back up a SharePoint site that uses SQL Always On as a content database, SQL logs are not truncated as expected.
  • You cannot verify tape library compatibility for tapes that use RSMCompatmode settings such as IBM 35xx, 2900, and so on.
  • If you have multiple SharePoint farms hosted on the same SQL cluster with different instances but the same database names, DPM cannot back up the correct SharePoint farm content.
  • If you run Update Rollup 7 for Data Protection Manager 2012 R2, and you have already configured online protection for one or more protection groups, trying to change the protection group populates the default DPM settings for the "Select long-term goals" wizard instead of the previous configured values.
  • When you try to protect a SQL failover cluster, the Data Protection Manager UI crashes for every backup or synchronization operation.
  • If you install Update Rollup 7 for Data Protection Manager 2012 R2, self-service recovery for SQL databases may not work, and you receive the following error message:
    Error message

Why Voyager Legend from Plantronics

September 30th, 2015


As I am always in the road and using Skype for business on daily basis . It is important to rely on a robust and high quality headset I choose  Voyager Legend from Plantronics this is why most of the IT professional choose Voyager Legend .

Simply Intuitive

Smart sensor technology reacts when you put the headset on, letting you quickly take a call without a click. If you’re already wearing it, Voyager Legend announces who’s calling and waits for you to say "Answer" or "Ignore." Simply tap the voice command button and ask to check battery level, connection status, and more. With technology this nimble, Voyager Legend is the first truly intelligent Bluetooth® headset

Moisture Protection

You can rely on the Voyager Legend to work as hard as you do, through rain, sweat and the inevitable coffee spill. Voyager Legend headsets are protected against sweat and moisture damage by P2i technology. The nano-coating is applied during the manufacturing process, resulting in invisible liquid repellent properties that also makes the headset more reliable, wherever your busy life takes you.

Smart Call Routing

Intuitively directs calls to your phone or headset, pauses music for incoming calls, and allows you to automatically answer by simply placing the headset on your ear.

Precision Audio

Multi-microphones optimize your voice and minimize noise caused by wind, movement, and background sounds.

Call Announce & Voice Commands

Announces incoming caller’s name and lets you say "answer" to accept the call or "ignore" to decline. Just say "answer" to take a call. Tap the voice button to check battery level, connection status, or dial Vocalyst to hear emails, newsfeeds, and more.

WSUS 2012 R2 Post Install failure

September 10th, 2015

I was trying to install WSUS on a 2012 R2 server and kept failing with the following error : Fatal Error: The system cannot find the path specified.

First I thought it is complaining because it cant access the folder content location, them I found that It can create the folder successfully , same for  the Database server it was able to create the registry entry for the database server.

when I verified the logs located at C:\Users\%username%\AppData\Local\Temp\2 I found the in the logs that it fails during the IIS Configuration, however the WSUS server is already created and bound  to correct port (in my case 8531, and 8530). image

On that server I had deleted the default web site with ID 1, as I never use the default site , so I thought it might WSUS requires the default site for the initial setup . Once I had recreated the site  I was able to successfully complete the Post installation


Problem with DPM 2012 R2 console after install RU5

February 14th, 2015

The Data Protection Manager console is unresponsive after installing Update Rollup 5


After installing Update Rollup 5 for System Center 2012 R2 Data Protection Manager and performing inquiry on either the local DPM server itself or on another attached DPM server (for secondary protection), you notice that the console crashes, and upon starting it again it is unresponsive and hung at one of the following windows. You notice that cmdlets are also unresponsive.




More Information

Steps to reproduce this behaviour

Scenario 1

1. You have never protected the local DPM server’s System State with the DPM server itself and have protected System State/Bare Metal Recovery for other production servers.

2. You upgraded to DPM 2012 R2 UR5 and triggered an inquiry on the DPM server itself either from the UI (by expanding\refreshing the DPM server in the Create Protection Group Wizard) or by executing cmdlets.

Scenario 2

1. You have a primary DPM server protecting the System State of a production server.

2. You have attached the primary DPM server to a secondary DPM server for secondary protection (Disaster Recovery)

3. You upgrade the secondary DPM server to DPM 2012 R2 UR5.

4. You trigger an inquiry on the primary DPM server in the secondary DPM server UI (by expanding\refreshing the DPM server in the Create Protection Group Wizard) or by executing cmdlets.


Please use the following steps to correct an issue in the DPM database that causes this behaviour:

1. Stop the following DPM services (from the Services MMC SnapIn by running services.msc) in this order:

a. DPM AccessManager Service

b. DPM

c. DPM Writer


2. Open the SQL Server Management Studio (from either the Start Screen or by running ssms.exe)

3. Connect to the SQL Server Instance hosting the DPM database

4. Locate the correct DPM database in the instance (name starts with DPMDB)

5. Important! Take a full backup of the database by using the following steps to able to revert changes in case you incorrectly apply any further steps:

a. Right click the database and select Tasks->Back Up

b. Choose the Backup type as “Full” and backup destination to safe location on the Disk

c. Click ‘Ok’ and make sure the backup completes successfully

6. Now run the clean-up script by using the following steps:

a. Right click the database again and select “New Query”

b. Paste the following SQL script:

DELETE FROM dbo.tbl_IM_ProtectedObject

WHERE ProtectedObjectId IN


SELECT PO.ProtectedObjectId

FROM dbo.tbl_IM_ProtectedObject AS PO

JOIN dbo.tbl_AM_Server AS SRVR

ON PO.ServerId = SRVR.ServerId

WHERE (CONVERT(VARCHAR(4096),PO.ComponentName) = ‘System State’ OR CONVERT(VARCHAR(4096),PO.ComponentName) = ‘Bare Metal Recovery’)

AND PO.ProtectedInPlan = 0

AND PO.ProtectedObjectId NOT IN (SELECT ProtectedObjectId FROM dbo.tbl_IM_ProtectedObjectAlerts)

AND LOWER(CONVERT(XML,PO.LogicalPath).value(



)) != LOWER(SRVR.ServerName)


c. Execute the query by pressing F5

d. Make sure that the query is executed successfully. Depending on your setup, it will output a message showing the number of rows affected.

7. Now go back to Services SnapIn to start the services in this order:

a. DPM

b. DPM AccessManager Service

c. DPM Writer


8. Now open the DPM console UI. It should work normally as before.

Update Rollup 5 for System Center 2012 R2 Data Protection Manager is now available

February 14th, 2015

Update Rollup 5 for System Center 2012 R2 Data Protection Manager .This is a feature-rich release and an important milestone in our cloud integrated backup vision. In the coming weeks, we will publish detailed blogs and videos of the new features, keep watching this space for more! Azure is an integral and important part of this update rollup. Every feature of this update has an element of Azure plugged in to it. Customers will experience similar functionality and a more seamless experience irrespective of whether their data is protected locally or to the cloud. We have enabled more features for customers who are already using Azure for their long term backup & retention needs. If Azure is not an integral part of your DPM led backup strategy, this release still provides a compelling value prop.

Why Update Rollup 5

  • Azure is an integral and important part of this update rollup
  • Support for new workloads
  • Better data transfer and retention options to Azure
  • Enhanced monitoring and alerting
  • Useful Links

    1. Description of Update Rollup 5 for System Center 2012 R2 Data Protection Manager
    2. Download the Data Protection Manager update package now.
    3. DPM team Blog about UR 5

    New in Windows Azure (VM Security Extensions)

    June 26th, 2014


    During TechEd NA 2014 , Microsoft announced bunch of new features that are supported by windows Azure ,  some of these new features are (VM Security Extensions, ExpressRoute GA, Reserved IPs, Internal Load Balancing, Multi Site-to-Site VPNs, Storage Import/Export GA, New SMB File Service, API Management, Hybrid Connection Service, Redis Cache, Remote Apps).

    one of my favorite feature is  VM Security Extensions.

    VM Security Extensions:  These extensions offer a richer security protection to the VMs hosted in Azure using industry security products. Currently there are new three extensions for Microsoft Antimalware , Symantec Endpoint Protection and TrendMicro’s Deep Security Agent.

    To enable any one the above extensions, login to  Azure Management Portal and check the extension when you create new a new Virtual Machine:


    but wait you can enable these extensions from Power shell , the following cmdlets are available



    AlwaysOn Protection With System Center Data Protection Manager 2012 R2

    April 27th, 2014


    I have been waiting for months to write this blog about how to protect AlwaysOn with DPM , the reason for the delay that DPM 2012 R2 before RU2 wasn’t supporting AlwaysOn  with Cluster. 

    for Enterprises looking for true disaster Recovery and avoid single point of failure,  AlwaysOn can be setup using SQL Cluster Instance with a stand alone SQL server Instance.meaning the primary replica is hosted on a SQL Cluster instance and Secondary replica is hosted on SQL Instance Standalone. the reason for that is to avoid the single point of failure such as the SAN

    As I mentioned earlier , before DPM rollup Update 2 for System center , DPM didn’t support Protecting AlwaysOn with Cluster Setup.

    First step:  Install DPM Client to your WFC nodes , make sure to patch your DPM server with the latest RU2


    Second Step: Create a Protection Group to protect databases on Clustered AlwaysOn .