DCR - CIMCmdlets need -Credential parameter - by Trevor Sullivan [MVP]

Status : 


Sign in
to vote
ID 797120 Comments
Status Active Workarounds
Type Suggestion Repros 2
Opened 8/12/2013 7:33:46 AM
Access Restriction Public


In Windows PowerShell version 3.0, the Get-CimInstance cmdlet does not have a -Credential parameter. This parameter could allow a user to specify alternate credentials to retrieve information from the Windows Remote Management (WinRM) service. Since this parameter does not exist, a significant amount of extra code is required to manually establish a CIM Session, and then later remove it.
The Get-WmiObject has a -Credential parameter however, which makes it much easier to use than its Get-CimInstance counterpart.
Since the Get-CimInstance cmdlet does not offer a -Credential parameter, and the Get-WmiObject cmdlet does offer it, the use of Get-CimInstance is naturally discouraged. Since Microsoft’s direction appears to encourage the use of DMTF standards-based systems management, I would recommend that a -Credential parameter be added to the Get-CimInstance cmdlet, so as to simplify PowerShell code.

The -Credential parameter should also be added to other, appropriate members of the CIMCmdlets PowerShell module.
Sign in to post a comment.