Tag Archives: WMI

Force attempt to provision vPro AMT using SCCM in-band provisioning

If you don’t properly configure your workstation for vPro AMT provisioning before the first SCCM agent call (e.g. you forget to set your certificate thumbprint in MEBx), you’ll end up waiting 24 hours for the machine to reattempt provisioning.  If you’re impatient (like me) you can use this technique to force a reattempt immediately (credit to William York – original source):

Manual Steps to issue WMI command:

  • Open a command prompt and type wbemtestThis is the Windows Management Instrumentation Tester
  • After the Windows Management Instrumentation Tester Utility Opens, click Connect
  • In the Namespace of the Connect Window, type the system name you want to force the check followed by \root\ccmExample: **
  • Click Connect
  • You can also simply run the command on the local system by simply leaving out the host name
  • Example: \root\ccm
  • After you successfully connect to the target system, click the Execute Method Button
  • In the Get Object Path window, type sms_clientin the Object Path fieldClick OK
  • In the Execute Method Window, enter TriggerSchedulein the Method FieldClick the Edit In Parameters Button
  • In the Object editor for _PARAMETERS window, Double Click the sScheduleID in the Properties field
  • In the Property Editor Window, change the Value to Not NULL and add the following {00000000-0000-0000-0000-000000000120}This value is the Object ID to initiate this OOB auto-provisioning check.
  • Click the Save Property button
  • In the Object editor for _Parameters window, click the Save Object button
  • In the Execute Method window, click the Execute Button
  • After you Execute the method, you should see a message that the Method was executed successfully
  • To confirm that your method was executed, look at the target systems c:\windows\system32\CCM\Logs\oobmgt.logYou should now see a new entry in the log GetProvisioningSetting indicating that the policy has been re-evaluated.

WMI Query for an Installed Application

Last night, I was reading an excellent blog post by Darren Mar-Elia on why the Win32_Product class sucks.  This got me asking the question: If you wanted to create a WMI query to determine whether or not a particular application was installed on a machine, how would you do it?  A quick Google search turned up nothing useful.  Not one to shy away from a puzzle, I set out to figure a solution.

My initial approach was to try StdRegProv, but alas, the class contains only methods.  While such a class could be used in a script, it is an automatic no-go for queries (since a query only reads properties).  Now this is starting to look like the evil Sudoku puzzle I agonized over last week… 

Others on the Interweb suggested using Win32_RegistryAction class.  This is a bad idea, since the class enumerates across the ENTIRE registry.  Wanna talk slow?  Hell, you’re better off using Win32_ProductClass over this dog.  Besides, I couldn’t ever get the damn thing to work.

So instead, query the file system.  The advantage to this method is that it’s fast.  Oh, did I mention that it’s fast?  Speed cannot be underappreciated, especially if your query is tied to a GPO.  Nothing says admin-hater like a user who has to wait ten minutes to log on.

As an example, if you want to see if Office 2007 is installed (in this case, Word).  Easy enough.  Create a query as follows:

Namespace: root\cimv2
Query: SELECT * FROM CIM_Datafile WHERE Name = ‘C:\\Program Files\\Microsoft Office\\Office12\\WINWORD.EXE’

Be sure to note that you need double whacks!  If you’re really rambunctious, you can also specify that you’re looking for a particular version by adding a

AND Version = ‘X.X.X.X’

which is useful if you checking for a patch.  Of course, you have to know where the application is installed.  You DID standardize your install packages, didn’t you?

Oh and one more thing… don’t get too crazy with WMI queries in your GPOs… these suckers get eval’d EVERY refresh cycle.  So use them as little as possible and tear them down when you don’t need them anymore.

Don’t say I never helped you out…