New-PSCredential¶
SYNOPSIS¶
Creates a PSCredential
SYNTAX¶
New-PSCredential [[-Username] <String>] [[-Password] <SecureString>] [-ProgressAction <ActionPreference>]
[-WhatIf] [-Confirm] [<CommonParameters>]
DESCRIPTION¶
Takes in a UserName and a plain text password and creates a PSCredential
EXAMPLES¶
EXAMPLE 1¶
New-PSCredential -UserName "Admin" -Password "P@ssw0rd!"
This creates a PSCredential with username "Admin" and password "P@ssw0rd!"
EXAMPLE 2¶
New-PSCredential -UserName "Admin"
Prompts user for password and creates a PSCredential with username "Admin" and password the user provided.
EXAMPLE 3¶
$SecretPassword = "P@ssw0rd!" | ConvertTo-SecureString -Force
New-PSCredential -UserName "Admin" -Password $SecretPassword
PARAMETERS¶
-Username¶
The username of the PSCredential
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: (Read-Host -Prompt 'Enter a username')
Accept pipeline input: False
Accept wildcard characters: False
-Password¶
The plain text password of the PSCredential
Type: SecureString
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: (Read-Host -Prompt 'Enter Password' -AsSecureString)
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf¶
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm¶
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction¶
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters¶
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.