Category Archives: PowerShell and CIM

Windows Updates CIM classes

When Windows 10 and Server 2016 were released they contained a new CIM namespace – ROOT/Microsoft/Windows/WindowsUpdate This contained a CIM class MSFT_WUOperationsSession that had 2 very useful methods – ScanForUpdates and  ApplyApplicableUpdates. These methods enabled you to find and install … Continue reading

Posted in PowerShell and CIM, WSUS | 1 Comment

Monitor resolution

A question on the forum about getting monitor resolution led to this code Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorId | foreach {        $filter = (“InstanceName = ‘$($psitem.InstanceName)'”).Replace(“`\”, “`\`\”)         $maxres = Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorListedSupportedSourceModes -Filter $filter … Continue reading

Posted in PowerShell and CIM | Leave a comment

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