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

PSCredential Class

 

Updated: April 27, 2016

Applies To: Windows PowerShell

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)

System.Object
  System.Management.Automation.PSCredential

[SerializableAttribute]
public sealed class PSCredential : ISerializable

NameDescription
System_CAPS_pubmethodPSCredential(PSObject)

Initializes a new instance of the PSCredential class with a username and password from PSObject.

System_CAPS_pubmethodPSCredential(String, SecureString)

Initializes a new instance of the PSCredential class that contains the user name and password for the credentials.

NameDescription
System_CAPS_pubpropertySystem_CAPS_staticEmpty

Gets a PSCredential object that contains no credential data.

System_CAPS_pubpropertySystem_CAPS_staticGetSymmetricEncryptionKeyDelegate

Gets or sets a delegate which returns the encryption key and initialization vector for a symmetric encryption algorithm. Introduced in Windows PowerShell 3.0.

System_CAPS_pubpropertyPassword

Gets the password of the user for these credentials.

System_CAPS_pubpropertyUserName

Gets the user name for these credentials.

NameDescription
System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetNetworkCredential()

Converts credential data into a NetworkCredential object.

System_CAPS_pubmethodGetObjectData(SerializationInfo, StreamingContext)

Populates an object with the data needed to serialize the PSCredential. Introduced in Windows PowerShell 3.0.

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

NameDescription
System_CAPS_puboperatorSystem_CAPS_staticExplicit(PSCredential to NetworkCredential)

Casts a PSCredential object as a NetworkCredential object.

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.

Return to top
Show:
© 2016 Microsoft