Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 1.0 » Get-Credential

Get-Credential - Powershell 1.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

Get-Credential

Description
Get a security credential (username/password)

Usage
Get-Credential [-credential] PSCredential [CommonParameters]

Options
-credential 
       A user name e.g."User01" or "Domain01\User01"

   CommonParameters:
       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.

Example(s)
Get a credential and save into a variable:

PS C:\>$ss64Cred = Get-Credential

Use the credential object (already stored in a variable) to run a Get-WmiObject command:

PS C:\>Get-WmiObject Win32_DiskDrive -ComputerName Server01 -Credential $ss64Cred

Including a Get-Credential command in a Get-WmiObject command:

PS C:\>Get-WmiObject Win32_DiskDrive -ComputerName Server01 -Credential (get-credential Domain01\User64)