Category Archives: PowerShell and CIM

Use CIM cmdlets not WMI cmdlets

WMI and CIM seem to cause a LOT of confusion. Its really simple. CIM is an industry standard from DMTF.org. WMI was Microsoft’s implementation of CIM way back in Windows NT days. The complication is that Microsoft had a set … Continue reading

Posted in PowerShell and CIM | 3 Comments

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

Change a computer’s description

The Win32_OperatingSystem class exposes the machines Description. This is how you can easily change a computer’s description. PS> Get-CimInstance -ClassName Win32_OperatingSystem | select Description Description ———– PS> Get-CimInstance -ClassName Win32_OperatingSystem | Set-CimInstance -Property @{Description = ‘Richards Laptop’} PS> Get-CimInstance -ClassName … Continue reading

Posted in PowerShell and CIM | Leave a comment

More diskinfo

Yesterday I showed how to get the disk, partition and logical disk information using CIM. Today I want to show more diskinfo techniques. This time we’ll use the Storage module which was introduced with Windows 8. Underneath the covers it … Continue reading

Posted in PowerShell and CIM, Storage | Leave a comment

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