PSCredential Class
Collapse the table of content
Expand the table of content

PSCredential Class

Represents a set of security credentials, such as a user name and a password.

Namespace: System.Management.Automation
Assembly: System.Management.Automation (in System.Management.Automation.dll)

Dim instance As PSCredential

<SerializableAttribute> _
Public NotInheritable Class PSCredential
	Implements ISerializable
/** @attribute SerializableAttribute() */ 
public final class PSCredential implements ISerializable
public final class PSCredential implements ISerializable

To create a secure cmdlet or provider, define a single parameter of this type instead of using separate parameters for the user name and password.

Do not use the constructor that is provided by this class directly to specify credentials. From scripts, use the Get-Credential cmdlet; from code, call the PromptForCredential method.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


Target Platforms

© 2016 Microsoft