syntax for setting NewPassword on a user via Powershell

  • 1
  • Question
  • Updated 4 weeks ago
I'm, I can't seem to translate between reading the API documentation for a password reset for a user and using this in powershell. 

i'm trying:
Send-SfRequest $sfClient -Method POST -Entity Users -id $id -Parameters @{"NewPassword"="abcdefg123!"}


I get error: 'Send-SfRequest : MethodNotAllowed:'

anyone know how to do this? or is there a good explanation on how to translate API doc into powershell?


Photo of robertm

robertm

  • 4 Posts
  • 0 Reply Likes

Posted 1 month ago

  • 1
Photo of Jeremiah Strong

Jeremiah Strong

  • 25 Posts
  • 2 Reply Likes
Hey, without really digging into this, I'm guessing the error is due to the account you are using is not a ShareFile Administrator account ( I think ShareFile states it as Super Admin). 

Check this out and hopefully it will help you if the above is not true: https://github.com/jstrong013/ShareFile/blob/master/Set-SFPassword.ps1 

Cheers,
Photo of robertm

robertm

  • 4 Posts
  • 0 Reply Likes
Thanks Jeremiah! champion! 

My account was all good, i wasn't using -Navigation, -BodyText or doing a convert-json to my password

work now with 
Send-SfRequest $sfClient -Method POST -Entity Users -id $user.id -Navigation ResetPassword -BodyText (@{"NewPassword"= "Welcome123!"} | ConvertTo-Json)