Category Archives: PowerShell and WMI

Examples of replacing WMI cmdlet with CIM cmdlet

Following my last post I was asked about these Examples of replacing WMI cmdlet with CIM cmdlet. Example 1 gwmi win32_operatingsystem -computername $Computer -credential $creds, $cs = New-CimSession -Credential $creds -ComputerName $computer Get-CimInstance -ClassName Win32_operatingsystem -CimSession $cs Example 2 get-wmiobject … Continue reading

Posted in PowerShell and CIM, PowerShell and WMI | 1 Comment

CIM not WMI

I still see a lot of people using the WMI cmdlets – Get-WmiObject etc. You really should be using CIM nit WMI. In other words use Get-CimInstance rather than get-WmiObject etc etc. Why do I say that? Two main reasons. … Continue reading

Posted in PowerShell and CIM, PowerShell and WMI | 2 Comments

Linking disks, partitions and logical drives

A question of the forums was asking about discovering disk information. They were trying to pipe the output of Get-WmiObject into another Get-WmiObject. that won’t work. There is another way. On Windows machines physical drives are divided into 1 or … Continue reading

Posted in PowerShell and CIM, PowerShell and WMI, Storage | Leave a comment

Finding a CIM class

One of the problems you might find is finding a CIM class. You know its name but you don’t know which namespace its in. The old WMI cmdlets allow you to search the namespaces recursively PS> Get-WmiObject -Class Win32_Process -Namespace … Continue reading

Posted in PowerShell and CIM, PowerShell and WMI | Leave a comment

Find the logged on user

One method of finding the logged on users is to use CIM $ComputerName = $env:COMPUTERNAME Get-CimInstance -ClassName Win32_Process -ComputerName $ComputerName -Filter “Name = ‘explorer.exe'” | foreach {         $lguser = Invoke-CimMethod -InputObject $psitem -MethodName GetOwner         $Properties = … Continue reading

Posted in PowerShell and CIM, PowerShell and WMI | Leave a comment

wmic deprecated

I saw a forum post today where the question involved the use of the wmi command line tool wmic. Wmic was deprecated in Windows Server 2012 – https://technet.microsoft.com/en-us/library/hh831568(v=ws.11).aspx. It will eventually be removed. You should use the CIM cmdlets instead … Continue reading

Posted in PowerShell and CIM, PowerShell and WMI | Leave a comment

Applying updates through WSUS

I like to keep the virtual machines in my test lab up to date so have a WSUS server to download and manage updates. The difficulty is applying the updates. With Windows 2012 R2 I used a module that would … Continue reading

Posted in PowerShell and CIM, PowerShell and WMI, Windows Server 2016, WSUS | Leave a comment