0

New OpsMgr 2012 Dashboards Repository in TechNet Gallery

Posted by Tao Yang on 23/07/2014 in SCOM |

With the recent release of OpsMgr 2012 SP1 UR6 and R2 UR2, number of new dashboard widgets have been made available. The PowerShell Grid Widget and PowerShell Web Browser Widget are 2 of my favourite ones.

Microsoft has just created a new repository for the community to share their scripts and dashboards. This repository is located in the TechNet Gallery Script Center. You can access it from this direct link: http://bit.ly/Wy168U. or go to the script center and browse to: System Center > Operations Manager Dashboards:

image

Looks like the product team has already posted 4 samples in the first day. In the next few days, I will also post few of mine to this place. I encourage everyone to keep eye on this place from now on, and please do not hesitate to share your work with the community!

Tags: ,

3

Location, Location, Location. Part 3

Posted by Tao Yang on 21/07/2014 in SCOM |

location-graphicThis is the 3rd and the final part of the 3-part series. In this post, I will demonstrate how do I track the physical location history for Windows 8 location aware computers (tablets and laptops), as well as how to visually present the data collected on a OpsMgr 2012 dashboard.

I often see people post of Facebook or Twitter that he or she has checked in at <some places> on Foursquare. I haven’t used Foursquare before (and don’t intend to in the future), I’m not sure what is the purpose of it, but please think this as Four Square in OpsMgr for your tablets Smile. I will now go through the management pack elements I created to achieve this goal.

Event Collection Rule: Collect Location Aware Device Coordinate Rule

So, I firstly need to collect the location data periodically. Therefore, I created an event collection rule targeting the “Location Aware Windows Client Computer” class I created (explained in Part 2 of this series). This rule uses the same data source module as the “Location Aware Device Missing In Action Monitor” which I also explained in Part 2. I have configured this rule to pass the exact same data to the data source module as what the monitor does, – so we can utilise Cook Down (basically the data source only execute once and feed the output data to both the rule and the monitor).

image

image

Note: Although this rule does not require the home latitude and longitude and these 2 inputs are optional for the data source module, I still pass these 2 values in. Because in order to use Cook Down, both workflows need to pass the exact same data to the data source module. By not doing this, the same script will run twice in each scheduling cycle.

This rule maps the data collected from the data source module to event data, and stores the data in both Ops DB and DW DB. I’ve created a event view in the management pack, you can see the events created:

SNAGHTMLb60c734

Location History Dashboard

Now, that the data has been captured and stored in OpsMgr databases as event data, we can consume this data in a dashboard:

SNAGHTMLb65f9e4

As shown above, there are 3 widgets in this Location History dashboard:

  • Top Left: State Widget for Location Aware Windows Client Computer class.
  • Bottom Left: Using PowerShell Grid widget to display the last 50 known locations of the selected device from the state widget.
  • Right: Using PowerShell Web Browser widget to display the selected historical location from bottom left PowerShell Grid Widget.

The last 50 known locations for the selected devices are listed on bottom left section. Users can click on the first column (Number) to sort it based on the time stamp. When a previous location is selected, this location gets pined on the map. So we known exactly where the device is at that point of time. – From now on, I need to make sure my wife doesn’t have access to OpsMgr in my lab so she can’t track me down Smile.

Note: the location shown in above screenshot is my office. I took my Surface to work, powered it on and connected to a 4G device, it automatically connected to my lab network using DirectAccess.

Surface in car

Since this event was collected over 2 days ago, for demonstration purpose, I had to modify the PowerShell grid widget to list a lot more than 50 previous locations.

The script below is what’s used in the bottom left PowerShell Grid widget:

Param($globalSelectedItems)

$i = 1
foreach ($globalSelectedItem in $globalSelectedItems)
{
$MonitoringObjectID = $globalSelectedItem["Id"]
$MG = Get-SCOMManagementGroup
$globalSelectedItemInstance = Get-SCOMClassInstance -Id $MonitoringObjectID
$Computername = $globalSelectedItemInstance.DisplayName
$strInstnaceCriteria = "FullName='Microsoft.Windows.Computer:$Computername'"
$InstanceCriteria = New-Object Microsoft.EnterpriseManagement.Monitoring.MonitoringObjectGenericCriteria($strInstnaceCriteria)
$Instance = $MG.GetMonitoringObjects($InstanceCriteria)[0]
$Events = Get-SCOMEvent -instance $Instance -EventId 10001 -EventSource "LocationMonitoring" | Where-Object {$_.Parameters[1] -eq 4} |Sort-Object TimeAdded -Descending | Select -First 50
foreach ($Event in $Events)
{
$EventID = $Event.Id.Tostring()
$LocalTime = $Event.Parameters[0]
$LocationStatus = $Event.Parameters[1]
$Latitude = $Event.Parameters[2]
$Longitude = $Event.Parameters[3]
$Altitude = $Event.Parameters[4]
$ErrorRadius = $Event.Parameters[5].trimend(".")

$dataObject = $ScriptContext.CreateInstance("xsd://foo!bar/baz")
$dataObject["Id"]=$EventID
$dataObject["No"]=$i
$dataObject["LocalTime"]=$LocalTime
$dataObject["Latitude"]=$Latitude
$dataObject["Longitude"]=$Longitude
$dataObject["Altitude"]=$Altitude
$dataObject["ErrorRadius (Metres)"]=$ErrorRadius
$ScriptContext.ReturnCollection.Add($dataObject)
$i++
}
}

 

And here’s the script for the PowerShell Web Browser Widget:

Param($globalSelectedItems)

$dataObject = $ScriptContext.CreateInstance("xsd://Microsoft.SystemCenter.Visualization.Component.Library!Microsoft.SystemCenter.Visualization.Component.Library.WebBrowser.Schema/Request")
$dataObject["BaseUrl"]="<a href="http://maps.google.com/maps&quot;">http://maps.google.com/maps"</a>
$parameterCollection = $ScriptContext.CreateCollection("xsd://Microsoft.SystemCenter.Visualization.Component.Library!Microsoft.SystemCenter.Visualization.Component.Library.WebBrowser.Schema/UrlParameter[]")
foreach ($globalSelectedItem in $globalSelectedItems)
{
$EventID = $globalSelectedItem["Id"]
$Event = Get-SCOMEvent -Id $EventID
If ($Event)
{
$bIsEvent = $true
$Latitude = $Event.Parameters[2]
$Longitude = $Event.Parameters[3]

$parameter = $ScriptContext.CreateInstance("xsd://Microsoft.SystemCenter.Visualization.Component.Library!Microsoft.SystemCenter.Visualization.Component.Library.WebBrowser.Schema/UrlParameter")
$parameter["Name"] = "q"
$parameter["Value"] = "loc:" + $Latitude + "+" + $Longitude
$parameterCollection.Add($parameter)
} else {
$bIsEvent = $false
}
}
If ($bIsEvent)
{
$dataObject["Parameters"]= $parameterCollection
$ScriptContext.ReturnCollection.Add($dataObject)
}

Conclusion

This concludes the 3rd and the final part of the series. I know it is only a proof-of-concept. I’m not sure how practical it is if we are to implement this in a corporate environment. i.e. Since most of the current Windows tablets don’t have GPS receivers built-in, I’m not sure and haven’t been able to test how well does the Windows Location Provider calculate locations when a device is connected to a corporate Wi-Fi.

I have also noticed what seems to be a known issue with the Windows Location Provider COM object LocationDisp.LatLongReportFactory. it doesn’t always return a valid location report. Therefore to work around the issue, I had to code all the scripts to retry and wait between attempts. I managed to get the script to work on all my devices. However, you may need to tweak the scripts if you don’t always get valid location reports.

Credit

Other than the VBScript I mentioned in Part 2, I was lucky enough to find this PowerShell script. I used this script as the starting point for all my scripts.

Also, when I was trying to setup DirectAccess to get my lab ready for this experiment, I got a lot of help from Enterprise Security MVP Richard Hick’s blog: http://directaccess.richardhicks.com. So thanks to Richard Smile.

Download

You can download the actual monitoring MP and dashboard MP, as well as all the scripts I used in the MP and dashboards HERE.

Note: For the monitoring MP (Location.Aware.Devices.Monitoring), I’ve also included the unsealed version in the zip file for your convenience (so you don’t have to unseal it if you want to look inside). Please do not import it into your management group because the dashboard MP is referencing it, therefore it has to be sealed.

Lastly, as always, I’d like to hear from the community. Please feel free to share your thoughts with me by leaving comments in the post or contacting me via email. Until next time, happy SCOMMING Smile.

Tags: , ,

1

Location, Location, Location. Part 2

Posted by Tao Yang on 21/07/2014 in SCOM |

miaThis is the 2nd part of the 3-part series. In this post, I will demonstrate how do I monitor the physical location of my location aware devices (Windows 8 tablets and laptops). To do so, I created a monitor which generates alerts when a device has gone beyond allowed distance from its home location. I will now go through each the component in the management pack that I created to achieve this goal.

Custom Class: Location Aware Windows Client Computer

I created a custom class based on “Windows Client 8 Computer” class. I needed to create this class instead of just using existing Windows Client 8 Computer class because I need to store 2 additional property values: “Home Latitude” and “Home Longitude”. Once been discovered, these 2 values will be passed to the monitor workflow so the script within the monitor can calculate the distance between current location and configured home location.

image

I created the following registry keys and values for this custom class:

Key: HKLM\SOFTWARE\TYANG\MonitorLocation

REG_SZ values: HomeLatitude & HomeLongitude

image

Discovery

I created a registry discovery targeting Windows Client 8 Computer class to discover the class (Location Aware Windows Client Computer) and the 2 properties I defined.

image

It is configured to run every 6 hours by default. This can be overridden.

Location Aware Device Missing In Action Monitor

image

image

To create this monitor, I firstly wrote a script to detect the current location and calculate the distance between the current location and home location (based on the registry value discovered).

Note: I managed to find few PowerShell scripts to calculate distance between 2 map coordinates (i.e. http://poshcode.org/2591 and http://stackoverflow.com/questions/365826/calculate-distance-between-2-gps-coordinates). However, I believe all the examples I found are not calculating the distance correctly. For example, I know for fact that the direct distance between my home to my office is somewhere between 23 – 25 kilometres. Using both of these scripts I mentioned, the calculated distance is around 16 kilometres. It is too short to be considered being correct. In the end, I found a VBScript from a Unix forum. The result from this script is just over 23km, which also matches the result from this online calculator. Therefore, I converted this VBScript into PowerShell and used it in this management pack. As I am really bad at math, I didn’t bother looking into the differences between these scripts. It is beyond my ability.

When the script runs, it logs an informational event (event ID 10003) if the current location is successfully detected:

SNAGHTMLb37b568

Or a warning event (event ID 10002) if the location data retrieved is not valid.

I then created Probe Action, Data Source modules and monitor type for this monitor. – All just usual drill, I won’t go through the details here.

As I have shown in the 1st and 2nd screenshots, I have configured required registry keys and values on my wife’s Dell XPS ultrabook (running Windows 8.1). The Home Latitude and Longitude coordinates are the location of my office. Because I configured the warning threshold to 5,000 metres (5km) and critical threshold to 10,000 metres (10km), a critical alert was generated against this XPS laptop:

SNAGHTMLb381a0e

For my Surface Pro 2, I configured the home location to be my home, therefore, currently as I’m home writing this blog post and it is right next to me, the health state for my Surface is healthy:

SNAGHTMLb3e690c

This concludes the 2nd part of the series. Please continue to Part 3.

Tags: , ,

1

Location, Location, Location. Part 1

Posted by Tao Yang on 21/07/2014 in SCOM |

iStock_000006260161SmallYes, I am starting to write a 3 part series on this topic: Location, Location, Location. It is not about real estate business – It would be silly for me to wait until I’ve received MVP award to become a real estate salesman, right? Smile

This series is all about tracking physical location for Windows based mobile devices (tablets and laptops). It involves windows tablets/ laptops, OpsMgr 2012, dashboards, Google Maps and Windows Location Platform. Does this interest you? if so, please continue reading. Smile

Background

When I started designing the OpsMgr 2012 infrastructure for my employer about a 18 months ago, during requirements gathering phase, Windows tablets were seriously in the scope of devices to be monitored by OpsMgr. At that time, I thought it doesn’t make any sense having OpsMgr 2012 to monitor thousands of Windows tablets. Now, 18 months later, with more and more organisations started to adopt Windows 8 tablets into corporate environments, I thought I’d spend a little bit time on this and see what we can get out of OpsMgr if Windows 8 tablets and laptops are being monitored in OpsMgr 2012.

Since most of the modern devices are location aware, wouldn’t it be nice if we can use SCOM to monitor their physical locations? I had this idea after I posted the Google Map dashboard couple of months ago. Now that FIFA World Cup is over and my life is back to normal, I finally had time to spend on it.

Introduction

One important aspect of tablets and laptops is being mobile. physical security has always been a big concern for organisations. By utilising Windows Location Framework, OpsMgr agent and dashboards, I managed to produce 3 scenarios in my lab. I will cover each one of them in one part of this series:

  • Part 1: Track Windows 8 computers current location (real time)
  • Part 2: Monitor the physical location (In case it’s gone M.I.A)
  • Part 3: Track historical locations (where have they been?)

Note: The management packs I created for this experiment can be downloaded at the end of part 3.

Pre-requisites

To prepare my lab of these monitoring scenarios, I had to setup the following pre-requisites:

01. Setup DirectAccess for my home lab so my Surface Pro 2 would automatically connect to my lab when it is not at home (i.e. via a 4G connection).

02. Rebuilt my Surface Pro 2 to Windows 8.1 Enterprise edition. – As DirectAccess client is only available in Enterprise edition.

03. Made sure Windows Location Platform is enabled on Surface Pro 2. This is configured in Control Panel:

image

and Privacy settings:

image

We can also use GPO to enable it: Computer Configuration\Administrative Templates\Windows Components\Location and Sensors

image

04. Make sure WinRM is enabled on the mobile devices. A PowerShell script I used in a dashboard uses WinRM to get the devices location report.

Additionally, I already have OpsMgr 2012 R2 agent installed on my Surface Pro 2 and it is reporting to my home management group. The latest OpsMgr 2012 Update Rollup (SP1 UR6 or R2 UR2) also needs to be installed in order to use the new PowerShell dashboard widgets.

Limitations – Lack of GPS Devices

When I started working on this experiment, I found my Surface Pro 2 does not have a GPS receiver (And Surface Pro 3 also doesn’t have it Sad smile). Then I also found most of the Windows 8 tablets currently out in the market don’t have GPS receivers built-in. I haven’t been able to find one with GPS receivers. Therefore, the location data provided by Windows Location API come from Wi-Fi triangulation, IP address resolution and cellular network triangulation, which is probably less accurate than GPS data (More details can be found on MSDN:http://msdn.microsoft.com/en-us/library/windows/apps/hh464919.aspx). I didn’t want to purchase a Windows 8 compatible GPS receiver because I have no real need for it after this experiment, and also tried to use my Android phone as a bluetooth GPS receiver to the Windows 8 devices, but I couldn’t make it work.

Having said that, based on my experience, the data received from cellular and Wi-Fi network is fairly accurate for me. When I’m at home, the location on the map is my neighbour across the road, which is less than 20 metres away from my desk.

Scenario 1: Where is the the device currently located?

I created a fairly simply dashboard in OpsMgr to pinpoint the current location of a selected:

SNAGHTMLa18e258

(Sorry guys, I pixelated the map as I don’t really want to post my home location on the Internet Smile).

As you can see, this dashboard only contains 2 widgets. the left widget is a state widget targeting “Windows Client 8 Computer” class:

SNAGHTMLa1bd8f3

SNAGHTMLa1c63fd

SNAGHTMLa1ced71

Note: Because I’m referencing Windows 8 computers, I have Windows 8 management packs (version 6.0.7024.0) loaded in my management group. Since all the client computers in my lab are running 8.1, I have also installed the Windows 8 Addendum MP from Kevin Holman as the original one does not discover Windows 8.1.

The widget on the right is a PowerShell Web Browser widget (shipped with SP1 UR6 and R2 UR2). This widget runs the script below:

Param($globalSelectedItems)
$dataObject = $ScriptContext.CreateInstance("xsd://Microsoft.SystemCenter.Visualization.Component.Library!Microsoft.SystemCenter.Visualization.Component.Library.WebBrowser.Schema/Request")
$dataObject["BaseUrl"]="<a href="http://maps.google.com/maps&quot;">http://maps.google.com/maps"</a>
$parameterCollection = $ScriptContext.CreateCollection("xsd://Microsoft.SystemCenter.Visualization.Component.Library!Microsoft.SystemCenter.Visualization.Component.Library.WebBrowser.Schema/UrlParameter[]")
foreach ($globalSelectedItem in $globalSelectedItems)
{
$globalSelectedItemInstance = Get-SCOMClassInstance -Id $globalSelectedItem["Id"]
$DNSNameProperty = $globalSelectedItemInstance.GetMonitoringProperties() | Where-Object {$_.name -match "^DNSName$"}
$DNSName = $globalSelectedItemInstance.GetMonitoringPropertyValue($DNSNameProperty)

#Get Coordinates via WinRM

#Create a WinRM session to the remote computer
$RemoteSession = New-PSSession -ComputerName $DNSName
$objRemoteLoc = Invoke-command -scriptblock {
# Windows Location API
$mylocation = new-object -comObject LocationDisp.LatLongReportFactory
#$mylocation.ListenForReports(1000)

# Get Status
$mylocationstatus = $mylocation.status

#try again if first attemp is not successful
if ($mylocationstatus -ne 4)
{
#Remove-Variable mylocation
Start-Sleep -Seconds 5
$mylocation = new-object -comObject LocationDisp.LatLongReportFactory
$mylocationstatus = $mylocation.status
}
If ($mylocationstatus -eq 4)
{
# Windows Location Status returns 4, so we're "Running"
# Get Latitude and Longitude from LatlongReport property
$latitude = $mylocation.LatLongReport.Latitude
$longitude = $mylocation.LatLongReport.Longitude
$altitude = $mylocation.LatLongReport.altitude
$errorRadius = $mylocation.LatLongReport.ErrorRadius
}

#Pass invalid values if location is not detected
If ($latitude -eq $null -or $longitude -eq $null)
{
$bValidLoc = $false
} else {
$bValidLoc = $true
}

#Return Data
$objLoc = New-Object psobject
Add-Member -InputObject $objLoc -membertype noteproperty -name "ValidLocation" -value $bValidLoc
Add-Member -InputObject $objLoc -membertype noteproperty -name "LocationStatus" -value $mylocationstatus
Add-Member -InputObject $objLoc -membertype noteproperty -name "latitude" -value $latitude
Add-Member -InputObject $objLoc -membertype noteproperty -name "longitude" -value $longitude
Add-Member -InputObject $objLoc -membertype noteproperty -name "altitude" -value $altitude
Add-Member -InputObject $objLoc -membertype noteproperty -name "errorRadius" -value $errorRadius
$objLoc
} -Session $RemoteSession
$latitude = $objRemoteLoc | select -ExpandProperty latitude
$longitude = $objRemoteLoc | select -ExpandProperty longitude
$ValidLocation = $objRemoteLoc | select -ExpandProperty ValidLocation
$parameter = $ScriptContext.CreateInstance("xsd://Microsoft.SystemCenter.Visualization.Component.Library!Microsoft.SystemCenter.Visualization.Component.Library.WebBrowser.Schema/UrlParameter")
$parameter["Name"] = "q"
$parameter["Value"] = "loc:" + $latitude + "+" + $longitude
$parameterCollection.Add($parameter)
Remove-PSSession $RemoteSession
}
$dataObject["Parameters"]= $parameterCollection
$ScriptContext.ReturnCollection.Add($dataObject)

This script establishes a PS Remote session (WinRM) and retrieve computer’s coordinates using LocationDisp.LatLongReportFactory COM object. the coordinates then get passed back to the local PS session and then got pinned on Google Map based on the latitude and longitude data.

This concludes part 1 of the series. Please continue to Part 2.

Tags: , ,

1

Setting up OpsMgr Knowledge Base on SharePoint 2010 Wiki

Posted by Tao Yang on 15/07/2014 in SCOM |

Previously, I blogged my opinion on using external knowledge base for OpsMgr. In that article, I mentioned a SharePoint 2013 Wiki solution developed by Stefan Koell. As I mentioned, I successfully set it up in my home lab without issues. However, I had issues setting it up at work, which is still using SharePoint 2010.

After going through what I’ve done with the SharePoint engineer in my company, I was told the issue is with WikiRedirect.aspx. I was told this page doesn’t exist on my SharePoint 2010 Enterprise Wiki site. So to work around the issue, I had to update Stefan’s JavaScript and made it work in SharePoint 2010. The UI looks a bit different than what WikiRedirect.aspx does, but essentially the same. The script redirects to a page if it already exists, or prompt to create a new page if it doesn’t exist.

Here’s what it looks like:

Redirects to an existing page:

image

Prompt to create a new page:

image

And here’s the script (I named it RedirectJs.txt):

<script type="text/JavaScript" unselectable="on">

// the path to the Enterprise Wiki Site in sharepoint
var SiteUrl = 'http://Sharepoint/Sites/SCOMKB/';

// make sure we only execute when a name is provided and when we are not in design/edit mode
var executeMain = false;
if (querystring('DisplayMode') == 'Design' || querystring('ControlMode') == 'Edit')
    executeMain = false;
else if (querystring('Name') == '' || querystring('Name') == null || querystring('Name') == undefined)
    executeMain = false;
else
    executeMain = true;

if (executeMain)
    main();

function querystring(key) {
    // helper function to access query strings
    var re=new RegExp('(?:\\?|&)'+key+'=(.*?)(?=&|$)','gi');
    var r=[], m;
    while ((m=re.exec(document.location.search)) != null) r.push(m[1]);
    return r;
}

function UrlExists(url)
{
    var http = new XMLHttpRequest();
    http.open('HEAD', url, false);
    http.send();
    return http.status!=404;
}
function load_url(externallink)
{
    //window.open(externallink,target='_blank');
	window.location = externallink;
}

function main()
{
	// strip " # % & * : < > ? \ / { } ~ | from name
	var name = querystring('name');
	name = unescape(name);
	name = name.replace("\"", '-');
	name = name.replace('#', '-');
	name = name.replace('%', '-');
	name = name.replace('&', '-');
	name = name.replace('*', '-');
	name = name.replace(':', '-');
	name = name.replace('<', '-');
	name = name.replace('>', '-');
	name = name.replace('?', '-');
	name = name.replace('/', '-');
	name = name.replace("\\", '-');
	name = name.replace('{', '-');
	name = name.replace('}', '-');
	name = name.replace('~', '-');
	name = name.replace('|', '-');
	// page url
	var pageName = name + '.aspx';
	var pageUrl = SiteUrl + '/Pages/' + pageName;
	var CreatePageUrl = SiteUrl + '/_layouts/CreatePage.aspx?IsDlg=1&Folder=RootFolder&Name=' + name;
	var pageExists = UrlExists(pageUrl);
	if (pageExists) {
		//open page
		load_url(pageUrl);
	} else {
		//Create New page
		load_url(CreatePageUrl);
	}
}
</script>

When you use this script, please update the SiteUrl variable to represent the URL of your SharePoint wiki site.

SNAGHTMLb695c2

Please note adding scripts to a web part is different in SharePoint 2010 than 2013. The script needs to be uploaded to the site as a separate file then link the the web part. here’s a good article on how to do it.

Note: I have also tested this script on my SharePoint 2013 wiki site. Unfortunately, it does NOT work.

Disclaimer:

My knowledge on SharePoint and JavaScript is next to none. Therefore, when I was told wikiredirect.aspx was the problem, I had to take his word for it. And I did lots of search online and came up with this JavaScript that worked for me. I won’t get offended if someone criticise me if my statement is wrong about SharePoint and if you think the script can be improved. Smile Lastly, please test it and make sure it works in your environment. I don’t have another SharePoint 2010 site I can test on, the only place I made it work is on my work’s production SharePoint site.

The script can also be downloaded HERE.

Tags: ,

3

Using an External Knowledge Base for OpsMgr

Posted by Tao Yang on 06/07/2014 in SCOM |

knowledge-baseSummary

I’ve been wanting to write a post on this topic for a while. Using an external knowledge base for OpsMgr is not something new. Many people have already shared their experiences on how to setup one up. My intention is to focus less on the technical side (i.e. How to set it up), but discussing what are the limitations of managing internal KB’s (company knowledge) natively within OpsMgr from both technical and organisational and social point of view and the how can we fill these gaps by using an external knowledge base management system.

Please Note: this post is 100% based on my own experience working on a very large OpsMgr environment which involves a mixture of 2007 and 2012 management groups and many support teams.

As I have been working for a “Customer” for the last 3 years instead of working for a solutions provider, who generally only spend a short period of time and move on to the next engagement, I am able to see the challenges within the organisation from a social and culture point of view. Hopefully you can pick up few points that also apply to your environment.

Knowledge Base Management in OpsMgr

In OpsMgr, knowledge base (KB) articles can exist in 2 places: Product Knowledge and Company Knowledge.

Product Knowledge: Written by the management pack author, generally saved in the sealed MP cannot be modified.

Operators can access product knowledge from either the alert view or the property window of the workflow:

image

image

Company Knowledge: Written my someone internally within your organisation. Consider it as an “Addendum” to the product knowledge. Generally OpsMgr operators use this functionality to store any organisation-specific information about the particular alert or workflow.

Company Knowledge articles can be added into the OpsMgr management group from a computer which has Operations Console, Microsoft Visual Studio Runtime for Office, and 32-bit Microsoft Word 2010 installed. These articles are saved into unsealed management packs. They can be viewed same way as product knowledge”:

image

image

Note: One thing I’ve picked up while writing this article is once the company knowledge for a particular alert is created and saved into an unsealed management pack, the alert view in Operations console will show the company knowledge article instead of the original product knowledge article. – Something I’ve never noticed in the past.

Use of Company Knowledge – Pros and Cons

In my opinion, using Company Knowledge in OpsMgr has the following Pros and Cons

Pros:

01. Built-in Functionality within OpsMgr. No additional systems required.

02. Can be viewed within OpsMgr Operations and Web Consoles

03. Company Knowledge can be retrieved programmatically using OpsMgr SDK

i.e. SCOM Enhanced Email Notification Script created by myself.

Cons:

01. Stored in Unsealed Management Packs meaning additional management pack dependencies (same as override MPs).

Company KB’s are stored the same way as product KBs, but they are stored in an Unsealed MP. The Unsealed MP therefore requires to reference the sealed MP (where the workflow for the KB is defined). This is very similar to creating overrides. As you wouldn’t save all your overrides in one single MP, same theory applies to company KB’s – We should use a dedicated unsealed MP for each product OpsMgr monitors (i.e. Company KB MP for SQL, Company KB MP for AD etc).

02. Operators requires at least OpsMgr Author access to add / manage company knowledge articles.

Therefore, it is probably not a good idea to grant normal operators access to create company KB’s because OpsMgr Author role also gives users access to create other management pack elements such as rules and monitors. However, As the nature of any knowledge base systems, you would encourage everyone to share their knowledge, not to limit the access to only fewer people (if this is the case, we might as well call this system a bulletin instead of a knowledge base).  In the past I have only given few particular users author access for this purpose – as result, not many company KB’s were created because people simply couldn’t be bothered.

03. Only text and hyper-links can be included in the knowledge articles.

Sorry, you can’t attach a script / Word documents / Visio diagrams / Pictures / Videos in OpsMgr KB articles. they are only text based.

04. Users can only create one (1) company KB per OpsMgr workflow and each Company KB is associated to only one (1) workflow

There’s a 1-to-1 relationship between KB articles and OpsMgr workflows (if the Company KB is created in the operations console). It is possible that you have many very similar monitors in your environments. i.e. In my environment, I have two (2) “Average Wait Time” monitors for SQL DB engines:

image

One of these monitor is targeting SQL 2008 and the other one is targeting SQL 2012. If you are to write a company KB, you will need to write 2 separate ones – One for each monitor, although the content could be exactly the same.

05. The KB article is only available WITHIN the OpsMgr management group Where it is created. There is no way to share it between multiple MG’s and it cannot be access outside of OpsMgr

Often, when I introduce OpsMgr Company Knowledge to support teams, the response I get is “but we’ve already got all our KB’s in xxxxx (name of a system).” Why would they have to adopt a new system and spend the effort of migrating everything to OpsMgr? And after everything is migrated, you can only access these information when you have access in OpsMgr? Additionally, same as overrides, when you created an override in one management group, it will not automatically appear in another management group. In my employer’s environment, I’ve already lost count how many Test / Dev / Production, 2007 / 2012 management groups we have in total. to keep Company KB’s consistent among all these management groups is a nightmare!

06. KB articles are not searchable.

That’s right, unlike other knowledge base products, you cannot search for a specific phrase among all KB articles. Well, it is probably possible via a script using SDK. But it is not something a normal SCOM operators can do.

07. No versioning control

As Company KB’s are stored in unsealed MPs, version control does not apply to Unsealed MPs. Plus, once you’ve updated a Company KB, unless you’ve saved the MP before modification, there is no way you can roll back to the previous version, and it is hard to track who created / updated it.

08. It is complicated to setup a computer to enable Company KB editing

To be able to create / edit Company KB’s, the computer requires the following applications:

  • OpsMgr Operations Console
  • Visual Studio Runtime for Office
  • 32-bit Microsoft Word

I always get confused on which version of Visual Studio Runtime for Office and MS Word is required for which version of OpsMgr. I had to google the requirements when every time I need to set one up. Currently, Word 2013 is not supported. So in my lab environment, I had to install Word 2010 on one machine where Office 2013 is installed everywhere else.

Using an External Knowledge Base Solution

There are many Knowledge sharing / Wiki solutions that you can choose from such as Microsoft SharePoint, WordPress or other Wiki applications. In fact, you may have already started using an external OpsMgr KB solution that you are not aware of – There is a very well-known community initiative called “ResearchThis!”. Essetially, ResearchThis is a collection of OpsMgr KB articles hosted on a WordPress site (www.systemcentercentral.com) and a MP which offers an alert task allowing OpsMgr operators to search support articles based on alert name. If you are using ResearchThis!, you have already adopted an external KB solution for your OpsMgr solution.

I believe by taking the Knowledge Base management out of OpsMgr and move to an external system that is designed for managing and sharing knowledge, we can overcome all the “Cons” I’ve listed above:

01. KB articles are not saved in management packs. less management packs = less maintenance effort.

02. Access to the Knowledge Base is controlled outside of OpsMgr. i.e. if you are using MS SharePoint, you can grant different level of access to users Active Directory IDs / Groups. People no longer needs access to OpsMgr to be able to share their knowledge. Therefore, no more excuses like “I don’t have access in SCOM” when you ask why didn’t they add a solution in the Company KB”.

03. Your KB articles are no longer text based. Depending on your external KB systems, you may add pictures, videos, attachments etc. to the article.

04. You can create multiple KB articles for a single alert, or a single KB article for multiple alerts, it is flexible.

05. For systems like WordPress and MS Sharepoint, not only you are able to search, but you can also use tags to further categorise your KB articles.

06. If you are running multiple OpsMgr management groups, you don’t need to have multiple instances of your KB solution of the choice. You can use a centralised knowledge base across all your management groups (and systems other than OpsMgr). personally, this is the what interests me the most based on my experience with my current employer. Not only we have many management groups (mixture of 2007 and 2012), but we also have different teams supporting same / similar systems. i.e. different support teams supporting Windows OS and other LOB applications. Some of these teams are located in different sites and they don’t know each other. By creating a centralised knowledge base will help different support teams to share their knowledge and increase productivity. – Or help to create a virtual team as what management would like to say.

07. Version Control is a standard feature in most of these systems (i.e. WordPress or MS SharePoint). You can easily roll back to previous versions and audit who created / updated the particular article.

08. No additional configuration is required on OpsMgr operators PCs. Well, it is probably more complicated to setup a SharePoint Wiki than to install all required components on a PC to enable Company KB editing. but the good thing is, you only need to do it once.

09. it is easy to extend your external KB solution to other OpsMgr management groups. i.e. If you would like to use “ResearchThis!”, all you have to do is to import the ResearchThis MP, which only contains few console tasks.

How To Setup an External Knowledge Base

Well, it depends on what type of system you’d like to implement. I don’t think anyone can write a single guide to cover it. Having said that, there are few examples out there we can refer to:

WordPress Example: ResearchThis!

Sharepoint Example: Use SharePoint Wiki as SCOM Knowledge Base (by Stefan Koell)

In my lab, I have setup a SharePoint 2013 Enterprise Wiki site as per Stefan Koell’s post.

image

Additionally I created a management pack which contains 4 tasks:

  • Open Knowledge Base (as per Stefan’s post)
  • Search Knowledge Base (Search the SharePoint Wiki Site)
  • Search in Google
  • Search in Bing
  • Search in ResearchThis!

The reason I didn’t use ResearchThis MP is because tasks in ResearchThis! MP only launches Internet Explorer (as Shown below):

SNAGHTML1bf56eb

And I created same tasks that launches user’s default web browser:

SNAGHTML1c1dab8

I have created this MP in VSAE and sealed it with a key. In a real life environment, I’d probably do the same and included this MP as a standard MP which should be imported into all the management groups within an organisation.

Tip: If you’d like to use ResearchThis! MP, but you don’t want OpsMgr operators to accidentally post sensitive information to the ResearchThis! KB because of the security concerns, you can simply remove the “Share This” task from ResearchThis! MP since it is unsealed.

Marnix Wolf has written an good article on how to create this type of console tasks a long time ago: http://thoughtsonopsmgr.blogspot.com.au/2010/09/scom-tasks-part-iv-lets-create-simple.html. If you’d like to use your default browser instead of IE, please use the command line from Rikard Ronnkvist’s comment in this post (the first comment).

Conclusion

As I stated in the beginning, this post is not a “How-To” guide. The intention is to help people making design decisions when designing OpsMgr solutions. This post is 100% based on my own experience and opinion. Please feel free to contact me if you want to a further discussion on this topic.

Tags: ,

12

MVP Award

Posted by Tao Yang on 02/07/2014 in Others |

Last night, I got an email from Microsoft and I have received the MVP Award for System Center Cloud and Datacenter Management. I’m so excited and honoured that I have been presented this wonderful award.

image

I started blogging in this blog 4 years ago because I thought I have learnt a lot from the community and I have something to share. I still remember the day when I sat on the couch setting up this blog while watching South Africa FIFA World Cup back in 2010. now 4 years later, I received this award during Brazil World Cup 2014 Smile.

I’d like to thank everyone in the System Center community for sharing and caring. The following blogs and web sites have been particularly helpful to me along the way (in alphabetical order):

I am looking forward to the next 12 months to come and I’ll definitely be even more involved in such a wonderful community!

By the way, it is good to see my old colleague and friend, the Inside Podcast host Dan Kregor also received his MVP award for the first time yesterday. Congrats Dan!

Tags:

6

OpsMgr 2012 Self Maintenance Management Pack 2.4.0.0

Posted by Tao Yang on 30/06/2014 in SCOM |

This blog has been a bit quiet lately because of 2 reasons: FIFA World Cup and I’ve been updating the OpsMgr 2012 Self Maintenance MP. :)

What’s new in version 2.4.0.0?

  • Corrected spelling mistake in Management Server maintenance mode watcher display name
  • Updated knowledge article for OpsMgr 2012 Self Maintenance Detect Manually Closed Monitor Alerts Rule
  • Additional Monitor: OpsMgr 2012 Self Maintenance Management Server Default Action Account OpsMgr Admin Privilege Monitor
  • Additional Monitor: OpsMgr 2012 Self Maintenance Management Server Default Action Account Local Admin Privilege Monitor
  • Additional Rule: OpsMgr 2012 Self Maintenance Obsolete Management Pack Alias Detection Rule
  • Additional Agent Task: Get Workflow Name(ID)
  • Additional Agent Task: Reset Monitor Health State
  • Additional Agent Task: Remove Obsolete MP References

Additional Monitors to check if management servers action account has local admin on management servers and OpsMgr privileges

I often get emails from people who are having issues configuring workflows in the Self Maintenance MP. I found one of a common issues is that the default action account for management servers does not required privileges. Therefore I created 2 monitors in this release to monitor if the MS action account has local administrator and OpsMgr administrator privileges.

image

image

Additional Rule: OpsMgr 2012 Self Maintenance Obsolete Management Pack Alias Detection Rule

As I mentioned in my previous post PowerShell Script: Remove Obsolete References from Unsealed OpsMgr Management Packs, I’ve created a rule that detects obsolete MP references in unsealed management packs. The difference between the stand alone script (from previous post) and this rule is, this rule would only detect obsolete MP references, it will not try to remove them. Operators can use the “Remove Obsolete MP References” agent task manually remove them (or using the standalone script I published earlier).

image

Additional Agent Task: Remove Obsolete MP References

This task targets All Management Servers Resource Pool and can be used in conjunction with the Obsolete Management Pack Alias Detection Rule to delete obsolete MP references from unsealed management packs.

SNAGHTML5ed69f2

Additional Agent Tasks: “Get Workflow Name(ID)” and “Reset Monitor Health State”

image

Previously, few people have suggested me to provide a method to reset all instances of a particular monitor. Recently, Cameron Fuller showed me a script from Matthew Dowst’s blog post and suggested me to add this into the Self Maintenance MP.

The script from Matthew’s blog resets health state of all instances of monitors with a given display name. In my opinion, this is not granular enough as there are monitors sharing same display name, we can not use display name to uniquely identify a particular monitor.

i.e.

image

Therefore, when I was writing the script for the Reset Monitor Health State agent task, I used monitor name instead of display name. However, since the monitor name is actually not viewable in the Operations Console, I had to create another agent task to get the name of a workflow (monitors, rules and discoveries).

i.e. let’s use the “Computer Browser Service Health” monitors as an example.

Get the monitor(s) using SCOM PowerShell Module:

image

In my environment, there are 2 monitors that have the same display name. the actual monitor name is highlighted in the red rectangles. the names are unique. It is actually the MP element ID in the management pack where the monitor is coming from:

image

So in order to use the “Reset Monitor Health State” task, operators firstly need to identify the monitor name (MP element ID), then paste it into an override field of the task. To make it easier, we can use the “Get Workflow Name(ID)” agent task to get the name:

image

Then copy and paste the monitor name into the “MonitorName” override parameter of the “Reset Monitor Health State”:

image

image

image

Where to find the detailed information for these additional items?

I have only covered a very high level overview of these additional workflows in this post. the detailed information can be found in the updated MP documentation (From Section 5.2.24 to 5.2.29):

image

Please make sure you read each section before enabling / using each workflow!

Credit

I’d like to thank Cameron Fuller, Bob Cornelissen and Raphael Burri for the suggestions and testing effort. Also, thanks Matthew Dowst for the original scripts in his posts.

Lastly, if you have suggestions or issues / questions that are not documented in the documentation, please feel free to contact me.

DOWNLOAD LINK

Tags: , ,

4

SCOM 2012 Maintenance Mode Scheduler V3 from Tim McFadden

Posted by Tao Yang on 25/06/2014 in SCOM |

Tim McFadden has just released the SCOM 2012 Maintenance Mode Scheduler Version 3.

New Dashboard

Tim and I updated the original management packs to cater for this release. The Dashboard MP has a new dashboard for version 3 which allows users to select a windows computer object from the state widget and create a maintenance mode schedule from the PowerShell contextual web browser widget:

image

The new MPs are included in the msi. they are located in “C:\Program Files\SCOM 2012 Maintenance Mode Scheduler\Management Packs” folder once the msi is installed.

My Upgrade Experience

I upgraded all 4 instances at work today. While I was upgrading it, I noticed that after the in place upgrade, all the settings are gone. I had to re-enter the following information:

  • Management Server address
  • SQL Server Address
  • Database Name
  • SDK User name and password
  • License Key
  • various tick boxes from admin.aspx page.
  • IIS .Net authorization rules

Therefore, to avoid unnecessary downtime, I’d recommend you to have all these information ready before the upgrade.

Tricks

Because we have multiple management groups at work, I have manually edited the WebHeader.png and WebHeader2.png files in “C:\inetpub\wwwroot\MMWeb\Content” and added a custom title on these image files so users can easily identify different instances for different management groups:

SNAGHTML9f3c96

SNAGHTMLa03202

Tags:

2

PowerShell Script: Remove Obsolete References from Unsealed OpsMgr Management Packs

Posted by Tao Yang on 24/06/2014 in PowerShell, SCOM |

Background

Last month, in TechEd North America, Cameron Fuller demonstrated a PowerShell script to search and remove obsolete MP references from an unsealed management pack. The script was written by Cameron’s colleague Matthew Dowst. You can watch Cameron’s presentation here and get the script here.

After TechEd, Cameron emailed me and suggest me to add this script into my OpsMgr Self Maintenance management pack. So before I built this functionality into the Self Maintenance MP, I have written a similar stand-alone script as a proof-of-concept.

Script Highlights:

The differences between my version and Matthew Dowst version are:

  • No need to export and re-import unsealed management packs: My script directly reads and updates MP contents using SCOM SDK. therefore unsealed MPs don’t need to be exported and re-imported.
  • Scan through all unsealed MPs: My script go through all unsealed MPs rather than individual XML files.
  • Option to backup MPs before changes are made: the script accept parameters to backup original unsealed MPs before any changes are made.
  • Option to increase MP version or keep version the same: Users can choose whether the MP version should be increased.
  • Allow test run (-WhatIf): Users can use –WhatIf switch to test run the script before changes are made.
  • MP Verify: the script verifies the MP before and after changes. if MP verify fails (including pre-existing errors), no changes will be made to the particular MP.
  • Allow Users to customize a “white list” for common MPs: When obsolete references are detected for the “common management packs” defined in the CommonMPs.XML (placed in the same folder as the script), these references will be ignored. This is because these common management packs are referenced in many out-of-box unsealed management packs by default. Additionally, since it is very unlikely these management packs will ever be deleted from the management group, therefore it should not be an issue when they are referenced in other management packs. Users can manually add / remove MPs from the list by editing the CommonMPs.XML. I have pre-populated the white list and included the following MPs:
    • Microsoft.SystemCenter.Library
    • Microsoft.Windows.Library
    • System.Health.Library
    • System.Library
    • Microsoft.SystemCenter.DataWarehouse.Internal
    • Microsoft.SystemCenter.Notifications.Library
    • Microsoft.SystemCenter.DataWarehouse.Library
    • Microsoft.SystemCenter.OperationsManager.Library
    • System.ApplicationLog.Library
    • Microsoft.SystemCenter.Advisor.Internal
    • Microsoft.IntelligencePacks.Types
    • Microsoft.SystemCenter.Visualization.Configuration.Library
    • Microsoft.SystemCenter.Image.Library
    • Microsoft.SystemCenter.Visualization.ServiceLevelComponents
    • Microsoft.SystemCenter.NetworkDevice.Library
    • Microsoft.SystemCenter.InstanceGroup.Library
    • Microsoft.Windows.Client.Library

Instruction:

You can run this script on any computers have OpsMgr 2012 console /agent / management server installed. The script includes a help documentation. you can access it via:

get-help .\MPReferencesCleanUp.ps1 –full

SNAGHTML436c9dc6

Examples:

#1. Test run using -WhatIf: .\MPReferencesCleanUp.ps1 -ManagementServer “OPSMGRMS01″ –BackupBeforeModify –BackupLocation “C:\Temp” -IncrementVersion –WhatIf

image

#2. Real run without –WhatIf: .\MPReferencesCleanUp.ps1 -ManagementServer “OPSMGRMS01″ –BackupBeforeModify –BackupLocation “C:\Temp” –IncrementVersion

image

Download

The script can be downloaded HERE.

What’s next?

As I mentioned in the beginning, the next version of the OpsMgr 2012 Self Maintenance MP will have the ability to detect and remove these obsolete references. The MP is pretty much done. I’ve sent it to few people to test. I should be able to publish it in few days. Despite the new functionalities of the self maintenance MP, this script will still be a good standalone tool to run ad-hoc when needed.

Credit

I’d like to thank the following people for testing and advices provided to this script (in random order):

  • Cameron Fuller
  • Raphael Burri
  • Marnix Wolf
  • Bob Cornelissen
  • Dan Kregor

I also want to thank Matthew Dowst for the original script and Matthew Long for his blog post where I got the ideas from.

Lastly, as always, please feel free to contact me if you have questions / issues.

Tags: ,

Copyright © 2010-2014 Tao Yang's System Management Blog All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.2.4.1, from BuyNowShop.com.