PowerShell for Windows Admins:

CIM


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...


March 30, 2016  10:44 AM

IIS 6.0 server information

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

A question of the forum asked about getting data from IIS 6.0 servers One of the ways to access this data is to use CIM (WMI). IIS 6.0 has the root\MicrosoftIIsV2  namespace. Later versions of Windows server also have a root\webadministration namespace which is preferred. The original...


March 22, 2016  12:46 PM

Breaking CIM sessions

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Powershell

A CIM session is analogous to a PowerShell remoting session but for CIM based cmdlets – the CIM cmdlets themselves and any CDXML based cmdlets e.g. the networking cmdlets By default a CIM session uses WSMAN as its transport protocol – the same as remoting. You do have the choice to create...


February 21, 2016  7:39 AM

IP Default Gateways

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, Network Adapter, Powershell

When you configure the IP Address on a network adapter you also have to set the default gateway if you want the machine to communicate with machines on other subnets. One way you can do this is through the SetGateways method of Win32_NetworkAdapterConfiguration $class = Get-CimClass...


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...


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: