Contact Info

Crumbtrail

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

Get-Credential - Powershell 1.0 CmdLet

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.

Get-Credential

Description
Get a security credential (username/password)

Usage


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)