PowerShell for Windows Admins:

CIM


January 31, 2016  5:57 AM

Scripting Game puzzle – – January 2016

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell

Here’s how I’d solve the puzzle function get-starttime { [CmdletBinding()] param( [parameter( ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] [Alias('CN', 'Computer')] [ValidateNotNullOrEmpty()] [string[]]$computername = $env:COMPUTERNAME ) PROCESS { foreach...

January 24, 2016  4:56 AM

CDXML filter parameters

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

I was recently asked about adding a filter parameter to a cmdlet created through CDXML. If you’ve not seen it before (see PowerShell and WMI Chapters 18 & 19 from www.manning.com) CDXML allows you to creat ecmdlets by wrapping a WMI class in some simple...


January 8, 2016  1:49 PM

WMI discovery

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

I’ve been working with System Center Configuration Manager this week. SCCM uses a lot of WMI. However, WMI discovery is still a bit of an art. I needed to find the SMS_SCI_Component class. If you know the namespace you can easily find the classes in that namespace but namespaces are...


December 22, 2015  9:36 AM

BinaryMiLog cmdlets

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

It’s not often I come across soemthing brand new in PowerShell but yesterday when I was investigating New-CimInstance I discovered 2 cmdlets in the CimCmdlets module I hadn’t noticed before. These are: Export-BinaryMiLog Import-BinaryMiLog The cmdlets are used to export, or import, CIM...


December 21, 2015  3:36 PM

New-CimInstance cmdlet and the–Key parameter

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

I was asked a question about the –Key parameter on New-CimInstance today. I wasn’t sure of the answer so I’ve done some experimentation. I tend to avoid New-CimInstance if I can preferring to use the Create method on the CIM class – however not all CIM classes have a create method so...


November 20, 2015  10:45 AM

Creating Registry Key

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

I had a question left on the blog asking how to create a registry key. My preferred method is to use the CIM class = StdRegProv. Its a static class so you don’t need to create an object [uint32]$hklm = 2147483650 $newkey = 'SOFTWARE\NewKey' Invoke-CimMethod -ClassName StdRegProv...


November 11, 2015  2:00 PM

WMI wildcards and filtering

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

A question on the forum asking about filtering WMI results raises a number of interesting points. The user wanted to pass a computername and a filter term to pull product information from remote machines. I ended up with this $computername = $env:COMPUTERNAME $filter = 'Live' $scriptblock...


October 17, 2015  4:00 AM

WMI linked classes

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

You will find that many WMI classes have links – some are associations built in to WMI (a subject for another time) while other classes can be linked based on property values. An example of the latter is the Win32_NetworkAdapter and Win32_NetworkAdapterConfiguration classes. The DeviceId on...


October 14, 2015  4:59 AM

NICs with IP addresses

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

A question on the forum asked about discovering those network adapters that had IP addresses configured. The user had tried PS> Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "IPAddress IS NOT NULL" Get-WmiObject : Invalid query "select * from...


September 29, 2015  1:42 PM

Win32_ReliabilityRecords Class

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

The Win32_ReliabilityRecords class was introduced with Windows 7. It contains information from the Windows Event Log related to system reliability. The most interesting properties are the Message and the TimeGenerated £> Get-WmiObject -class win32_reliabilityRecords | select -First 1 | fl...


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: