New-Credential

Creates a new PSCredential object from a given username and password.

Syntax

New-Credential [-User] <String> [-Password] <String> [<CommonParameters>]

Description

Many PowerShell commands require a PSCredential object instead of username/password. This function will create one for you.

Parameters

Name Type Description Required? Pipeline Input Default Value
User String The username. true false
Password String The password. true false

Return Values

System.Management.Automation.PSCredential.

EXAMPLE 1

New-Credential -User ENTERPRISE\picard -Password 'earlgrey'

Creates a new credential object for Captain Picard.