snazy2000/SnipeitPS

Password required when making new user

bmangia2 opened this issue · 3 comments

Context

When creating a new user with:
New-Snipeituser -first_name Snipe -last_name Test -username stest@mindex.com -activated $false -phone "9999" -ldap_import $false

I get back the error:

Write-Error: C:\Program Files\WindowsPowerShell\Modules\SnipeitPS\1.10.220\Public\New-SnipeitUser.ps1:148
Line 148:
        $result = Invoke-SnipeitMethod @Parameters     
        password -------- {The password field is required.}

I checked over the documentation and it lists password as non-mandatory. The only way I found to get around it while testing was to add:
-ldap_import $true
(it should be noted that my domain is not synced to SnipeIT)

After checking through some old Issues I found one where you listed:
password_confirmation = $password

If I'm understanding this properly then when I make the user I should also add
-password password
to my new user line?

I apologize if this is self explanatory as I'm new to scripting but hopefully you can help clarify this for me and it may help someone in the future too.

My Environment

  • SnipitPS Module version used: Latest
  • Operating System and PowerShell version: Wind 10, PowerShell 7
  • Snipe It version: Latest

As snipe-it documentation shows password and password_confirmation are required by api when creating new user. Password_confirmation is added by SnipeitPS so that that's not needed when using this module.

image

@bmangia2 After PR #267 and installing latest release (>= 1.10.222) of SnipeitPS you can create user without password by using -import_ldap $true . And then later you you can use following to remove ldap flag.

New-Snipeituser -first_name Snipe -last_name Test -username stest@mindex.com -activated $false -phone "9999" -ldap_import $true
set-snipeituser -id [someid] -import_ldap $false

Awesome thanks for the feedback! This helped a lot!