0161 871 6951 enquiries@apajove.com

Working with Configuration Manager, I am constantly reminding customers that Configuration Manager is a patient man’s tool. Oftentimes there’s no point in trying to speed the application along, there’s latency built into some of the processes occurring under the Configuration Manager hood and there’s generally not a great deal of point in interfering…

That said, I do like SCCM Client Center from Roger Zander. I personally preferred the look and feel of the old SMS Client Center over the new version, but nonetheless, you can get some great results with the new one.

Anyhow, I digress. As I’ve been mucking about fixing hundreds and hundreds of duplicate GUIDs, I’ve also been monkeying around with PowerShell manipulating clients. I am aware of a number of console extensions that enable you to do this kind of thing to whole collections, but, I’m a command-line guy and I am generally working on customer’s infrastructures so don’t want to be cluttering up the console. Further to this, I now frequently use a sequenced version of the Configuration Manager console which makes adding in extensions a little more complex.

As you’re probably aware, PowerShell makes WMI handling nice and easy. I’m a fan of WMIC (WMIC COMPUTERSYSTEM GET MODEL is my 3rd favourite command line trick) but it isn’t remotable, and won’t run through PSExec :-( I specifically wanted a few hundred machines to give me a DDR this morning, I was in that kind of mood, so to PowerShell.

 

Powershell WMI

First thing to do is to create yourself a function. Open the PS console:

 

Function GenerateDDR
{
$SMSCli = [wmiclass] \$strComputerrootccm:sms_client
$SMSCli.TriggerSchedule(“{00000000-0000-0000-0000-000000000003}”)

}

 

You’ll need to press return a couple of times after the last line. Now we can execute:

 

GenerateDDR MYCOMPUTERNAME

 

Brilliant. There are a few different trigger actions:

Trigger Actions

Hardware Inventory {00000000-0000-0000-0000-000000000001}

Software Inventory {00000000-0000-0000-0000-000000000002}

Discovery Data Record {00000000-0000-0000-0000-000000000003}

Machine Policy Retrieval & Evaluation {00000000-0000-0000-0000-000000000021}

File Collection {00000000-0000-0000-0000-000000000010}

SW Metering Usage Report {00000000-0000-0000-0000-000000000022}

Windows Installer Source List {00000000-0000-0000-0000-000000000032}

Software Updates Scan {00000000-0000-0000-0000-000000000113}

Software Updates Store {00000000-0000-0000-0000-000000000114}

Software Updates Deployment {00000000-0000-0000-0000-000000000108}

 

There are also a bunch of other client methods:
EvaluateMachinePolicy, GetAssignedSite, PDPMaintenanceTask, RepairClient, RequestMachinePolicy, ResetGlobalLoggingConfiguration, SetAssignedSite, SetClientProvisioningMode and SetGlobalLoggingConfiguration.

 

So obviously the above function could be modified easily to a GenerateHW, GenerateSW etc. function just by modifying the last two or three digits of the Trigger type.

Now, using the fantastic file handling available in PS we can remotely run this against loads of machines (as long as they’re powered up and accessible…)

To do this we use the magic FOREACH command:

foreach ($StrComputer in Get-Content D:ClientFixtest.csv) {GenerateDDR $StrComputer}

 

The output of this (assuming the machines are powered up) is:

 

image

 

For me, this is a great way of performing bulk live client manipulation. PowerShell is a superb utility, but unless I use it frequently I find I quickly forget the syntax of the commands and have to start from scratch every time. This year I’ve promised myself I’m going to migrate from black screen to blue, time to move on from CMD.EXE.