Reporting on 1E Nomad Enterprise activity in SCCM

Most 1E products have dedicated reporting, however Nomad Enterprise does not.
This may be because adverts are already well reported on by SCCM via Status Messages, and usually the buck stops here. However you may still want to know more
about how it actually got there…
I order to “see the Nomad story” we can actually take advantage of Status Messages as well, and hence this will allow us to report on Nomad directly in SCCM!

First we need to configure Nomad to send the status messages.
You can do this at install time using the MSI property STATUSMSGEVENTS, or after the install directly in the registry or via GPO.
The possible values for this can be found in the Admin guide, I am not going to copy paste this massive document here :)
Be careful not to simply select “Everything” as this can be quite spammy! The report I wrote uses these messages:
Evt_Rqst_Started >>> I use this to identity the Package that we download and the start time
Evt_MasterChanged >>> This is being used to see from which machine this client actually downloads.
Evt_Completed >>> If Nomad finished successful this is used to record the end time.
Evt_Error >>> If Nomad errors for any reason this is used to record the end time as well as the detailed error message.
This means I have to set my STATUSMSGEVENTS to 0x0000002064

Now onto the report itself
This is actually an older report I did for a customer back in SMS 2003 times. I was surprised to find out the query still worked fine for SCCM and the latest Nomad,
so I thought let me polish it back up and share it on my blog.
This really answers who on the subnet became the master? How long did the master take to download it from the DP, and how soon did everyone finish downloading it,
of course it also is a good tool to find machines that had any kind of error.

Here I have chosen to display one advert but for all sites and packages. I was cheeky and hard coded (non existing) DP path in SCCM halfway through to get some error messages.

SQL Challenges
There where numerous challenges in this one!
First of all the Status messages are split into many rows, I joined them back up via FOR XML as a kind of rows concatenation trick.  Let me show you.
Say you have a sales territory team: Tom, Jerry, Micky and Mouse.  (Copyright expired on these names, right? Damn you Walt)
I am going to aggregate the whole team and display the sum. However I also would like to display each Team members name in order of sales.

SELECT TerritoryID
, SUM(SalesYTD) AS TerritorySales
, Accounts = REPLACE((            SELECT
SalesPersonID AS [data()]
[AdventureWorks].[Sales].[SalesPerson] XMLSales
XMLSales.TerritoryID = Sales.TerritoryID
FOR XML PATH ('') ), ' ', ',')
FROM [AdventureWorks].[Sales].[SalesPerson] Sales
GROUP BY TerritoryID

This can be run against the good old sample Microsoft DatabaseAdventureWorks.
In effect this is like a glorified subquery. The REPLACE function is added to add commas between the sales reps. The MIN and MAX function can be used to similar effect but only for the largest and smallest of the aggregated values. Some of the status messages here contain 4 rows, so concatenation them together seemed like the best course of action. Later on I can get to my desired value via the SUBSTRING command.

The next challenge was the fact that only the Evt_Rqst_Started message contained the PackageId. This is made worse if you consider that each advert may really copy down multiple packages.
The way I solved it is to first define for each Package and Advert the start and end time, and then update the previous table with the PackageId between those timeframes.
I usually do not like using temp tables, but in this case it made it a whole lot easier. Due to this it’s advisable to filter by AdvertID – if filtration is needed – instead of PackageId.


Followup 11/28/2012
This report has been further developed to have additional features such as reporting on BITS and TS downloads as well.
Additionally 1E has created 7 further reports on Nomad and bundled them into a reporting pack that you can freely request from 1E.
Here are some screenshots from the improved report(s). I am leaving this original report intact as this one still works fine and is a classic report, whereas the report pack is SSRS based.


Let’s add some SCCM right click actions for 1E’s NightWatchman too!

There are 1E wake up action already for turning machines on, however there maybe also sometimes the need to turn machines off on demand (or restart, or sleep).
Thanks to the easy expandability of SCCM it’s not all that hard to do so.

First we need an XML file that defines the action we want to take. I have named this XML 1ENightWatchman.xml
Next we need to have some kind of provider. I did this as a script as I feel it allows people to take my work and expand on it as needed – even if I may have lost interest.
The provider is called 1ENighWatchmanProvider.vbs – Yes, I am THAT creative :)

Now we need to find these files the appropriate home.
The XML file MUST reside in these folders for the SCCM console to parse:
First browse to this folder <Your SCCM Folder>\AdminUI\XmlStorage\Extensions\Actions
Here you will find folders that seem to be named at random – but not so. These are the GUID of the exposed SCCM objects. We are interested in the following:

Single Machine Actions: 7ba8bf44-2344-4035-bdb4-16630291dcf6
First-level collections: fa922e1a-6add-477f-b70e-9a164f3b11a2
Sub Collections: dbb315c3-1d8b-4e6a-a7b1-db8246890f59
Collection instance. Details pane: f91c082d-bb83-44db-8ab9-907607b1dc44

Simply copy the 1ENightWatchman.xml into all 4 of these folders, provided you want to have single machine and collection based actions.
(I am most definitely not taking responsibility if you send out a FORCE shutdown to “All Systems” collection by accident!)

Also copy 1ENighWatchmanProvider.vbs into <Your SCCM Folder>\AdminUI\XmlStorage\Tools (This folder may need to be created)

How it works:
The provider will make WMI connections and starts the Nightwatchman.exe ( CMD interface of NightWatchman Client) on the remote machine and sets the defined action.
This means the account running the SCCM Console would need to be a local admin on the target machines. The Nightwatchman.exe can actually also make remote connections natively,
however I found the WMI approach gives better flexibility.

Code flow:
1.)First it makes sure the target machine is actually on (ping able). For speed purpose this is done asynchronous in WMI, otherwise each machine that is Off or behind a firewall would cause a 2-3 seconds delay!
2.)Next it will connect to the machine via WMI and read the Nightwatchman folder from the registry in case it’s not in C:\Program Files. We also determine at this point if we are dealing with a 5.6 or a 6.0 or even a x64 flavor of these.
3.)Because we are using the OnceOff command, the script now determines the local time on the target machine so we can execute the OnceOff on the next full minute mark.
4.)Now it will execute the selected command. Since we are using OnceOff for this purpose, the command will not be executed right away but with a slight delay (2-62 Seconds).
5.) Now we create a reporting popup that shows which machine failed at which point for which reason. You can copy paste this into an excel if you are so inclined.

Let’s Add additional Commands!
Great – every environment’s needs is a bit different, so I’ve made it easy so that it can be done by editing the XML file only.
Simply copy any of the existing ActionDescription whole XML tags and add/change the command and description. Note any change in the XML file require a restart of the SCCM console to take effect.

Ok, Let’s add for example a passive Shutdown – great way to ensure you’re not shutting down the bosses computer while he’s still logged in :) Adding bold for emphasis.

<ActionDescription DisplayName="Shutdown System Passively" MnemonicDisplayName="Shutdown System Passively " Description="Shutdown System only if no one is logged in">
<Parameters>..\XmlStorage\Tools\NWMOnceOffProvider.vbs /OnceOff:YES /ShutdownAction:POWEROFF /LogOffAction:PASSIVE /countdownsecs:5 /TargetName:##SUB:Name## /TargetColl:##SUB:CollectionID## /Namespace:\\##SUB:__Server##\##SUB:__Namespace##</Parameters>

Known issues
Machines with 1E NightWatchman installed but unlicensed will still return a success message.

Planned improvements:
Add support to display a custom message to the end user. i.e “Admin Ben is restarting this machine in order to Apply Windows 7 SP1.”

First, while I work for 1E this is not a “1E Expansion” and has been created in my spare time, so don’t start sending support tickets if this tool does not work. I’ll support it on this blog or the myitforum only and you use this at your own risk.
Thanks to chiners_68 and msilva597 for the testing and having the patience to actually see it through, and now SHUT IT DOWN! <<< Download link.