Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


2022-09-21T15:43:50Z
Hey,

when i try to change the password of a local VCUser i get the following Errormessage:

Exception calling "UpdateUserPassword" with "2" argument(s): "Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index"

The error only occurs if i create the user using the api.
If i create the user using the visualcron client it works just fine, so i think there must be something i did wrong

Here is my code for creating the user


### CREATE SECUSER CLASS ###
$newUser = [VisualCron.SecUserClass]::new()
$newUser.Name = $server.Encrypt('test')
$newUser.UserName = $server.Encrypt('test')
$newUser.PassWord = $server.Encrypt('test')
$newUser.Email = $server.Encrypt('test@test.com')
$newUser.Groups = "1df408ab-c2e3-41b6-ba0e-9b17b3b6743a" # Set Admin UserGroup

### SAVE NEW USER ###
$server.Permissions.AddUser($newUser)

And here the code for changing the password where the method "UpdateUserPassword" throws the execption
$user = $server.Permissions.GetUser($newUser.Id)
$server.Permissions.UpdateUserPassword($user.Id, 'test234')


What am i doing wrong?

Thank you
Best regards,
lhgsct3
Sponsor
Forum information
Users browsing this topic
Scroll to Top