PowerTip: Working with Alternate Credentials with WMI

Doctor Scripto

Summary: Learn four  ways to supply alternate credentials with WMI and Windows PowerShell.

Hey, Scripting Guy! Question How can I supply alternate credentials for a remote WMI call when I am using the Get-WmiObject cmdlet?

Hey, Scripting Guy! Answer

a. Use the credential parameter as shown here.

Get-WmiObject Win32_BIOS -ComputerName Server01 -Credential (get-credential ` Domain01@User01)

b. Use the credential parameter as shown here.

$c = Get-Credential

Get-WmiObject Win32_DiskDrive -ComputerName Server01 -Credential $c

c. Create a CIM session to the remote system by using the New-CimSession.

d. Create a PS session to the remote system by using New-PSSession.

0 comments

Discussion is closed.

Feedback usabilla icon