< Back

New-StoredCredential

Mon Jan 13, 2020 6:35 am

NAME New-StoredCredential



SYNOPSIS

Create a new credential in the Windows Credential Store/Vault





SYNTAX

New-StoredCredential [-Comment <string>] [-Password <string>] [-Persist <CredPersist>] [-Target <string>] [-Type

<CredType>] [-UserName <string>] [<CommonParameters>]



New-StoredCredential [-Comment <string>] [-Persist <CredPersist>] [-SecurePassword <SecureString>] [-Target

<string>] [-Type <CredType>] [-UserName <string>] [<CommonParameters>]



New-StoredCredential [-Comment <string>] [-Credentials <PSCredential>] [-Persist <CredPersist>] [-Target <string>]

[-Type <CredType>] [<CommonParameters>]





DESCRIPTION

Create a new credential in the Windows Credential Store/Vault





PARAMETERS

-Target <string>

Specifies the target of the credentials being added.



Required? false

Position? named

Default value DESKTOP-6O28IQJ

Accept pipeline input? false

Accept wildcard characters? false



-UserName <string>

specified the username to be used for the credentials, cannot be used in conjunction with Credentials

parameter.



Required? false

Position? named

Default value Dave

Accept pipeline input? false

Accept wildcard characters? false



-Password <string>

Specifies the password in plain text, cannot be used in conjunction with SecurePassword or Credential

parameters.



Required? false

Position? named

Default value 2hxmOG=wM:

Accept pipeline input? false

Accept wildcard characters? false



-SecurePassword <SecureString>

Specifies the password as a secure string, cannot be used in conjunction with SecurePassword or Credential

parameters.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Comment <string>

Provides a comment to identify the credentials in the store





Required? false

Position? named

Default value Updated by: Dave on: 10/06/2016

Accept pipeline input? false

Accept wildcard characters? false



-Type <CredType>

Type of credential to store, possible values are [GENERIC, DOMAIN_PASSWORD, DOMAIN_CERTIFICATE,

DOMAIN_VISIBLE_PASSWORD, GENERIC_CERTIFICATE, DOMAIN_EXTENDED, MAXIMUM, MAXIMUM_EX]



Required? false

Position? named

Default value Generic

Accept pipeline input? false

Accept wildcard characters? false



-Persist <CredPersist>

sets the persistence settings of the credential, possible values are [SESSION, LOCAL_MACHINE, ENTERPRISE]



Required? false

Position? named

Default value Session

Accept pipeline input? false

Accept wildcard characters? false



-Credentials <PSCredential>





Required? false

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.Management.Automation.PSCredential







OUTPUTS

PSCredentialManager.Common.Credential





---------- EXAMPLE 1 ----------



PS C:\\> New-StoredCredential -Target server01 -UserName test-user -Password Password1



creates a credential for server01 with the username test-user and password Password1



Flags : 0



Type : GENERIC



TargetName : server01



Comment : Updated by: Dave on: 23/04/2016



LastWritten : 23/04/2016 10:48:56



PaswordSize : 18



Password : Password1



Persist : SESSION



AttributeCount : 0



Attributes : 0



TargetAlias :



UserName : test-user

---------- EXAMPLE 2 ----------



PS C:\\> Get-Credential -UserName test-user -Message "Password please" | New-StoredCredential -Target Server01



Creates a credential for Server01 with the username and password provided in the PSCredential object from

Get-Credential



RELATED LINKS

Online Version https://github.com/davotronic5000/Power ... Credential