dbatools is a free PowerShell module with over 300 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


This function centralizes all requests for information retrieved from Get-WmiObject or Get-CimInstance.
It uses different protocols as available in this order:
– Cim over WinRM
– Cim over DCOM
– Wmi
– Wmi over PowerShell Remoting
It remembers channels that didn’t work and will henceforth avoid them. It remembers invalid credentials and will avoid reusing them.
Much of its behavior can be configured using Test-DbaWmConnection.




Retrieves the common operating system informations from the local computer.

Get-DbaCmObject win32_OperatingSystem

Retrieves the common operating system informations from the server sql2014.
It will use the credewntials stored in $cred to connect, unless they are known to not work, in which case they will default to windows credentials (unless another default has been set).

Get-DbaCmObject -Computername “sql2014” -ClassName Win32_OperatingSystem -Credential $cred -DoNotUse CimRM


This command was created by Friedrich Weinmann. You can find Fred on blogging at allthingspowershell.blogspot.de and Tweeting at @FredWeinmann


From PowerShell, execute Get-Help Get-DbaCmObject -Detailed for more information on this function.

Source Code

Want to see the source code? View Get-DbaCmObject.ps1 on GitHub

Related commands