Tag Archives: WMI

Running a VBscript from batch (command line)

1 Nov , 2016,
, ,
No Comments

Most of the time a specific scripting language is chosen to provide an automated solution for something.
In this case a customer was already using batch scripting. I was adding simple VBscripts to query the WMI Namespaces. Well, how to use these different scripts in hybrid and pass values back to the original batch startup script?

The VBS being used in this example is checking WMI for the Write Filter State (used in the Windows Embedded OS).
Microsoft is using the commands available to check and manage the filter and splitting the huge output to find the current state of the writefilter here. In my opinion it is better to use the information available in WMI:

The cscript //nologo is the most important part of the command you use to start the .VBS!
When we compare the output without the nologo switch we see these differences:

Now to call the and get it’s result and put it in a variable

BTW, Very usefull when creating WMI code is the WMI Code Generator created by Rob van der Woude.

Create shortcuts to deploy available applications ConfigMgr 2012 (using PoSH)

22 Sep , 2015,
, , ,
No Comments

For a customer implementing Configuration Manager 2012 the use of the Application Catalog and Software Center can be a big change for the end-users. This when they have not used SCCM software and/or user-portal centric delivery before.
I was looking for possibilities to create a situation to start an application deployment with a more common interface like the start menu or the desktop.
Since the startmenu is back in modern OS-versions to deliver the apps for the user I decided to try and use it for this.
start menu available app example install

To automate it I have created a simple script that will create shortcuts you can use to start the deployment. On the background it uses Configuration Manager Client SDK WMI Classes
It’s not being used in production, so it is not completely functional with user rights but it was much easier to create than I expected. So use this at you own risk and make it better yourself :).

The code should explain itself because it’s not that difficult. You can play with the Get-WmiObject and the Where-Object options to test your exact results.

This creates (for example) a shortcut to install Mozilla Firefox with the target:
start menu available app shortcut firefox
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File C:\Deploy-CCM_App.ps1 -ApplicationName "Mozilla Firefox (nl)"

Read More…