The New-CimSession command is a powerful tool in the Windows PowerShell environment. It enables users to create a CIM session and establish a connection to a remote computer. This command is useful for managing and configuring Windows systems remotely, as well as for troubleshooting and diagnosing issues. In this guide, we will explore the syntax, parameters, inputs, outputs, examples, and tips for using the New-CimSession command.
Syntax
The syntax for the New-CimSession command is as follows:
New-CimSession [[-ComputerName]
Parameters
The New-CimSession command has several parameters that can be used to customize the command. These parameters are listed in the table below.
Parameter | Description |
---|---|
-ComputerName | Specifies the name of the remote computer to which the CIM session will be established. |
-Authentication | Specifies the authentication mechanism to be used for the CIM session. The default is Negotiate. |
-Credential | Specifies the credentials to be used for the CIM session. |
-SessionOption | Specifies the options to be used for the CIM session. |
-OperationTimeoutSec | Specifies the timeout period for the CIM session. |
-Protocol | Specifies the protocol to be used for the CIM session. The default is WSMan. |
-ThrottleLimit | Specifies the maximum number of concurrent operations that can be performed in the CIM session. |
-AsJob | Runs the command as a background job. |
-WhatIf | Shows what would happen if the command were to run. |
-Confirm | Prompts the user for confirmation before running the command. |
Inputs
The New-CimSession command does not accept any inputs.
Outputs
The New-CimSession command returns a CimSession object that contains information about the CIM session.
Examples
The following example creates a CIM session to a remote computer named “Server01” using the Negotiate authentication mechanism:
New-CimSession -ComputerName “Server01” -Authentication Negotiate
The following example creates a CIM session to a remote computer named “Server01” using the Kerberos authentication mechanism and the specified credentials:
New-CimSession -ComputerName “Server01” -Authentication Kerberos -Credential (Get-Credential)
Tips
When using the New-CimSession command, there are several tips to keep in mind:
- Specify the name of the remote computer to connect to using the -ComputerName parameter.
- Specify the authentication mechanism to use for the CIM session using the -Authentication parameter.
- Specify the credentials to use for the CIM session using the -Credential parameter.
- Specify the options to use for the CIM session using the -SessionOption parameter.
- Specify the timeout period for the CIM session using the -OperationTimeoutSec parameter.
- Specify the protocol to use for the CIM session using the -Protocol parameter.
- Specify the maximum number of concurrent operations that can be performed in the CIM session using the -ThrottleLimit parameter.
- Run the command as a background job using the -AsJob parameter.
- Preview the results of the command using the -WhatIf parameter.
- Prompt the user for confirmation before running the command using the -Confirm parameter.
Conclusion
The New-CimSession command is a powerful tool in the Windows PowerShell environment. It enables users to create a CIM session and establish a connection to a remote computer. This command is useful for managing and configuring Windows systems remotely, as well as for troubleshooting and diagnosing issues. In this guide, we have explored the syntax, parameters, inputs, outputs, examples, and tips for using the New-CimSession command.