Author | Friedrich Weinmann (@FredWeinmann) |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Get-DbaCmObject on GitHub.
Want to see the Bill Of Health for this command? Check out Get-DbaCmObject.
Retrieves Wmi/Cim-Style information from computers.
This function centralizes all requests for information retrieved from Get-WmiObject or Get-CimInstance.
It uses different protocols as available in this order:
Get-DbaCmObject
[-ClassName] <String>
[-ComputerName <DbaCmConnectionParameter[]>]
[-Credential <PSCredential>]
[-Namespace <String>]
[-DoNotUse {None | CimRM | CimDCOM | Wmi | PowerShellRemoting}]
[-Force]
[-SilentlyContinue]
[-EnableException]
[<CommonParameters>]
Get-DbaCmObject -Query <String>
[-ComputerName <DbaCmConnectionParameter[]>]
[-Credential <PSCredential>]
[-Namespace <String>]
[-DoNotUse {None | CimRM | CimDCOM | Wmi | PowerShellRemoting}]
[-Force]
[-SilentlyContinue]
[-EnableException]
[<CommonParameters>]
PS C:\> Get-DbaCmObject win32_OperatingSystem
Retrieves the common operating system information from the local computer.
PS C:\> Get-DbaCmObject -Computername "sql2014" -ClassName Win32_OperatingSystem -Credential $cred -DoNotUse CimRM
Retrieves the common operating system information from the server sql2014.
It will use the Credentials 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).
The name of the class to retrieve.
Alias | Class |
Required | True |
Pipeline | false |
Default Value |
The Wmi/Cim query to run against the server.
Alias | |
Required | True |
Pipeline | false |
Default Value |
The computer(s) to connect to. Defaults to localhost.
Alias | |
Required | False |
Pipeline | true (ByValue) |
Default Value | $env:COMPUTERNAME |
Credentials to use. Invalid credentials will be stored in a credentials cache and not be reused.
Alias | |
Required | False |
Pipeline | false |
Default Value |
The namespace of the class to use.
Alias | |
Required | False |
Pipeline | false |
Default Value | root\cimv2 |
Connection Protocols that should not be used.
Alias | |
Required | False |
Pipeline | false |
Default Value | None |
Overrides some checks that might otherwise halt execution as a precaution
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Use in conjunction with the -EnableException switch.
By default, Get-DbaCmObject will throw a terminating exception when connecting to a target is impossible in exception enabled mode.
Setting this switch will cause it write a non-terminating exception and continue with the next computer.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |