From a016c4eb542aabd4bd8368684e7126b453b2b560 Mon Sep 17 00:00:00 2001 From: Frank Geisler Date: Fri, 18 Aug 2023 08:05:21 +0200 Subject: [PATCH] Corrected some typos in description, added password to mandatory, test if password is less than 8 chars --- SnipeitPS/Public/New-SnipeitUser.ps1 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/SnipeitPS/Public/New-SnipeitUser.ps1 b/SnipeitPS/Public/New-SnipeitUser.ps1 index 30f42dd..1a7776a 100644 --- a/SnipeitPS/Public/New-SnipeitUser.ps1 +++ b/SnipeitPS/Public/New-SnipeitUser.ps1 @@ -14,11 +14,11 @@ .PARAMETER username Username for user - .PARAMETER active + .PARAMETER activated Can user log in to snipe-it? .PARAMETER password - Password for user + Password for user. The password should at least be 8 characters long. .PARAMETER notes User Notes @@ -63,7 +63,7 @@ Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. .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 .NOTES @@ -86,6 +86,8 @@ function New-SnipeitUser() { [parameter(mandatory = $true)] [string]$username, + [ValidateScript({$_.Length -ge 8}, ErrorMessage = "Password should be at least 8 characters.")] + [parameter(mandatory = $true)] [string]$password, [bool]$activated = $false, @@ -122,6 +124,7 @@ function New-SnipeitUser() { [string]$apiKey ) begin { + Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters