Get-CimInstance is a Windows PowerShell command that allows users to access and manage information about Windows-based computers. It is a powerful command that can be used to retrieve information about the system, such as hardware and software configuration, installed applications, and more. In this article, we will explore the syntax, parameters, inputs, outputs, examples, and tips for using Get-CimInstance.

Syntax

The syntax for the Get-CimInstance command is as follows:

Get-CimInstance [-ClassName] <String> [-ComputerName <String[]>] [-Namespace <String>] [-Filter <String>] [-Property <String[]>] [-Credential <PSCredential>] [-Impersonation <ImpersonationLevel>] [-ThrottleLimit <Int32>] [-AsJob] [-Authentication <AuthenticationLevel>] [-Locale <String>] [-EnableAllPrivileges] [-OperationTimeout <Int32>] [-Protocol <DCOMProtocol>] [-ResourceUri <Uri>] [-AuthenticationLevel <AuthenticationLevel>] [-CertificateThumbprint <String>] [-Key <String>] [-SessionOption <CimSessionOption>] [-OperationTimeoutSec <Int32>] [-Port <Int32>] [-UseSsl] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob] [-PipelineVariable <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

Parameters

The Get-CimInstance command has several parameters that can be used to customize the output of the command. These parameters are listed below:

Parameter Description
-ClassName Specifies the name of the CIM class to be retrieved.
-ComputerName Specifies the name of the computer to be queried.
-Namespace Specifies the CIM namespace to be queried.
-Filter Specifies a filter to be used to limit the results of the query.
-Property Specifies the properties to be retrieved from the CIM class.
-Credential Specifies the credentials to be used to access the computer.
-Impersonation Specifies the impersonation level to be used when accessing the computer.
-ThrottleLimit Specifies the number of concurrent operations that can be performed.
-AsJob Runs the command as a background job.
-Authentication Specifies the authentication level to be used when accessing the computer.
-Locale Specifies the locale to be used when accessing the computer.
-EnableAllPrivileges Specifies whether all privileges should be enabled when accessing the computer.
-OperationTimeout Specifies the timeout for the operation.
-Protocol Specifies the protocol to be used when accessing the computer.
-ResourceUri Specifies the URI of the resource to be accessed.
-AuthenticationLevel Specifies the authentication level to be used when accessing the computer.
-CertificateThumbprint Specifies the thumbprint of the certificate to be used when accessing the computer.
-Key Specifies the key to be used when accessing the computer.
-SessionOption Specifies the session options to be used when accessing the computer.
-OperationTimeoutSec Specifies the timeout for the operation in seconds.
-Port Specifies the port to be used when accessing the computer.
-UseSsl Specifies whether SSL should be used when accessing the computer.
-CimSession Specifies the CIM session to be used when accessing the computer.
-ThrottleLimit Specifies the number of concurrent operations that can be performed.
-AsJob Runs the command as a background job.
-PipelineVariable Specifies the variable to be used when accessing the computer.
-WhatIf Shows what would happen if the command were to run.
-Confirm Prompts the user for confirmation before running the command.

Inputs

The Get-CimInstance command requires the following inputs:

  • ClassName: The name of the CIM class to be retrieved.
  • ComputerName: The name of the computer to be queried.
  • Namespace: The CIM namespace to be queried.
  • Filter: A filter to be used to limit the results of the query.
  • Property: The properties to be retrieved from the CIM class.

Outputs

The Get-CimInstance command produces the following outputs:

  • Objects: An array of objects that represent the CIM class.
  • Errors: Any errors that occurred during the execution of the command.

Examples

The following examples demonstrate how to use the Get-CimInstance command:

  • To retrieve information about the system, use the following command:

    Get-CimInstance -ClassName Win

Leave a Reply