< Back

New-GzPassword

Tue Jan 14, 2020 12:25 am

NAME New-GzPassword



SYNOPSIS

Generates a new cryptographically secure password as a char array.





SYNTAX

New-GzPassword [[-Length] <Int32>] [[-CharSets] <String[]>] [[-Chars] <String>] [[-Validate] <ScriptBlock>]

[-AsSecureString] [-AsString] [<CommonParameters>]





DESCRIPTION

Generates a new cryptographically secure password with a given length

using the supplied characters.





PARAMETERS

-Length <Int32>

Optional. The length of the password that is generated. The default is 16



Required? false

Position? 1

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-CharSets <String[]>

Optional. An array of choices that leverages a group of characters to use to build

the password. The default is 'LatinAlphaUpperCase', 'LatinAlphaLowerCase', 'Digits', 'SpecialHybrid'



Required? false

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Chars <String>

An string of characters to use to build the password.



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Validate <ScriptBlock>

Optional. A script block that validates the password to ensure it meets

standards. The default checks for one uppercase, one lowercase, one digit,

one special character.



Required? false

Position? 4

Default value

Accept pipeline input? false

Accept wildcard characters? false



-AsSecureString [<SwitchParameter>]

A flag that instructs the result to be returned as a SecureString.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-AsString [<SwitchParameter>]

A flag that instructs the result to be returned as a string.



Required? false

Position? named

Default value False

Accept pipeline input? false

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



OUTPUTS



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



PS C:\\>$pw = New-Password -Length 16 -AsSecureString -CharSets 'LatinAlphaUpperCase', 'LatinAlphaLowerCase',

'Digits', 'SpecialHybrid'



Generates a new password with 16 characters with 1 upper, 1 lower, 1 digit, and one special character.











RELATED LINKS