PowerShell for Windows Admins:

CIM


September 16, 2016  12:45 PM

Dealing with CIM properties that are integer arrays

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell, WMI

Saw a post about WmiMonitorID that intrigued me If you use the WmiMonitorID: PS> Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorID | select -f 1 Active                 : True InstanceName           :...

September 3, 2016  12:14 PM

Open source PowerShell and OMI

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Open source, Powershell

OMI – the Open Source CIM server is available on github https://github.com/Microsoft/omi This appears to be a later version than currently shown on the open group web site Combine this with open...


August 30, 2016  12:26 PM

Optimising WMI calls–part 3

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell, WMI

The next change just uses 1 call to get the disk information instead of 2 Measure-Command -Expression { $srvs = 'W16TP5TGT01', 'W16TP5TGT02' for ($i=1; $i -le 150; $i++){ foreach ($srv in $srvs) { $cs = New-CimSession -ComputerName $srv $bootupMemory = Get-CimInstance -Query "SELECT *...


August 30, 2016  11:41 AM

Optimising WMI calls–part 2

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell, WMI

Last time we looked at using CIM sessions to make a set of WMI calls run quicker. This time we’ll reduce the number of calls.  I’m deliberately just reducing the number of calls to the Win32_Service class.  We’ll look at the disks another time Our code becomes Measure-Command...


June 11, 2016  4:28 AM

WMI classes and Storage cmdlets

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell, WMI

There is a hierarchy of objects to work through when dealing with disks First you have the physical disk PS>  Get-CimInstance -ClassName Win32_DiskDrive | fl Partitions : 5 DeviceID   : \\.\PHYSICALDRIVE0 Model      : HFS256G3AMNB-2200A Size       :...


June 10, 2016  6:59 AM

WMI Filters

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell, WMI

A common mistake with WMI/CIM filters is: PS>  Get-WmiObject -Class Win32_LogicalDisk -Filter "DeviceId=C:" Get-WmiObject : Invalid query "select * from Win32_LogicalDisk where DeviceId=C:" At line:1 char:1 + Get-WmiObject -Class Win32_LogicalDisk -Filter "DeviceId=C:" +...


April 25, 2016  8:33 AM

Cim session oddity

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell, WMI

The CIM cmdlets were introduced with PowerShell 3.0.  You can use the –ComputerName parameter to access a remote machine or, if you need to run multiple commands to the remote machine, you can create a CIM session. CIM sessions are analogous to PowerShell remoting sessions and use WSMAN by...


April 14, 2016  8:27 AM

Folder creation dates from WMI

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell, WMI

A question on the powershell.org about finding the creation date of folders raises some interesting points To find a folder’s creation date use: Get-WmiObject -Class Win32_Directory -Filter "Drive='C:' AND Path = '\\users\\$user\\'" | select Name, @{N='Creation date';...


April 12, 2016  3:33 PM

Monitor Info

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell, WMI

A question on the forum about combining information from 2 CIM classes produced this: function Get-MonitorInfo { [CmdletBinding()] param( $computername = $env:COMPUTERNAME ) $cs = New-CimSession -ComputerName $computername $monitors =  Get-CimInstance -Namespace root\wmi -ClassName...


March 31, 2016  1:01 PM

IIS information

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, IIS, Powershell, WMI

In my recent post about getting server information from a IIS web server I said I post about getting similar information from later machines. You still have the root\MirosoftIISv2 namespace available if you install the IIS 6.0 tools but one question to keep in mind – how long will they...


Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: