Corrected some typos in description, added password to mandatory, test if password is less than 8 chars

This commit is contained in:
Frank Geisler 2023-08-18 08:05:21 +02:00
parent 29c23e92ea
commit a016c4eb54

View file

@ -14,11 +14,11 @@
.PARAMETER username .PARAMETER username
Username for user Username for user
.PARAMETER active .PARAMETER activated
Can user log in to snipe-it? Can user log in to snipe-it?
.PARAMETER password .PARAMETER password
Password for user Password for user. The password should at least be 8 characters long.
.PARAMETER notes .PARAMETER notes
User Notes User Notes
@ -63,7 +63,7 @@
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE .EXAMPLE
New-Snipeituser -fist_name It -lastname Snipe -username snipeit -activated $false -company_id 1 -location_id 1 -department_id 1 New-Snipeituser -first_name It -last_name Snipe -username snipeit -activated $false -company_id 1 -location_id 1 -department_id 1
Creates new a new user who can't login to system Creates new a new user who can't login to system
.NOTES .NOTES
@ -86,6 +86,8 @@ function New-SnipeitUser() {
[parameter(mandatory = $true)] [parameter(mandatory = $true)]
[string]$username, [string]$username,
[ValidateScript({$_.Length -ge 8}, ErrorMessage = "Password should be at least 8 characters.")]
[parameter(mandatory = $true)]
[string]$password, [string]$password,
[bool]$activated = $false, [bool]$activated = $false,
@ -122,6 +124,7 @@ function New-SnipeitUser() {
[string]$apiKey [string]$apiKey
) )
begin { begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters