WMIX– PowerShell WMI Extensions

Today i will be looking at an useful PowerShell module called “WMIX” created by Kirk Munro of quest powergui fame.

 

Download  – WMIX: 
  https://wmix.codeplex.com/

What it Does:

Enumerates all the WMI classes on the system where it is run and creates PowerShell advanced functions out of them complete with help and examples!

Take a look at this article for more information about WMI:
    http://www.powershellpro.com/powershell-tutorial-introduction/powershell-scripting-with-wmi/

 

How to Install:

You can either download the msi installer or the zip file, personally i prefer the zip file . Extract the WMIX.zip file that you downloaded and place it in your “Modules” folder.

on my windows 8 system the modules folder is located here:

‘C:\Users\kiran\Documents\WindowsPowershell\Modules’

 

In case your documents folder does not contain a folder named “WindowsPowershell” simply create one and add a subfolder named “Modules” .

Since WMIX depends on another PowerShell module called “PSPX” ( helps create proxy functions), we need to download that and extract it to the modules path noted above. If you don’t know what proxy functions are or what they do, no need to worry because WMIX takes care of everything behind the scenes. We just need to make sure that PSPX is available in the modules folder.

Download – PSPX :
  http://pspx.codeplex.com/
So your modules folder should now have two subfolders:

modules folder

Now its time to import the module. We will need to open windows PowerShell as an administrator. You can use the console or PowerShell ISE.

powershell run as administrator

Note :  By default PowerShell’s execution policy prevents you from running any scripts so you might want to take a look at this MS Article and make sure the execution policy is set to – RemoteSigned

 

Type the following command:

prompt

since the default is “yes” hit enter. Depending on your OS you may or may not get this error. but if you do follow these steps.

 

PS C:\Windows\system32> Import-Module wmix

Where-Object : You cannot call a method on a null-valued expression.

At C:\Users\kiran\Documents\WindowsPowerShell\Modules\wmix\Update-WmiFunctionLibrary.ps1:271 char:64

+                     $typeFiles = @($Host.Runspace.InitialSessionState.Types | Where-Object {-no …

+                                                                              

PS C:\Windows\system32> 

 

 

 browse to the WMIX folder and open the file in PowerShell ISE – ‘UpdateWmiFunctionLibrary.ps1’

image

go to line “ 271” and find the following code.

Replace it with the line below:

 

while you are at it you might want to do the same to line- ‘267’

Now lets retry the import-module command:

image

If you see the green\teal progress bar shown above, that means we are good Smile. The module will now go through all the WMI classes and generate Functions for each. You will see what I mean in a moment.

Lets take a look and see how many functions were created:

PS C:\> Get-Command -Module wmifx | Measure-Object

 

 

Count    : 249

Average  :

Sum      :

Maximum  :

Minimum  :

Property : 

 

So on my system I got back 249 items, which means a total of 249 functions were added !. The count will vary based on the software installed on your system.

 

Note :  We use WMIFX as the module name instead of WMIX because wmix creates   a dynamic module called wmifx which contains all the functions we want to use.

 

Now to see what functions were added, type the command below

PS C:\> Get-Command -Module wmifx

 

Name                                               ModuleName

—-                                               ———-

Get-1394Controller                                 wmifx    

Get-ApplicationService                             wmifx    

Get-AutochkSetting                                 wmifx    

Get-BaseBoard                                      wmifx    

Get-Battery                                        wmifx    

Get-Binary                                         wmifx    

Get-BIOS                                           wmifx    

Get-BootConfiguration                              wmifx    

Get-Bus                                            wmifx    

Get-CacheMemory                                    wmifx    

Get-CDROMDrive                                     wmifx    

Get-ClassicCOMClass                                wmifx    

Get-ClassicCOMClassSetting                         wmifx    

Get-ClusterShare                                   wmifx    

Get-CodecFile                                      wmifx    

Get-CommandLineAccess                              wmifx    

Get-ComponentCategory                              wmifx    

Get-ComputerSystem                                 wmifx    

Get-ComputerSystemProduct                          wmifx    

Get-Condition                                      wmifx    

Get-CurrentProbe                                   wmifx    

Get-DataFile                                       wmifx    

Get-DCOMApplication                                wmifx    

Get-DCOMApplicationSetting                         wmifx    

Get-Desktop                                        wmifx    

Get-DesktopMonitor                                 wmifx     

 

In the next article we will learn how to use some of these functions.

Leave a Comment Yourself

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">