Hello @roro_coeur ,
It seems you are trying to run this code via a javascript activity in a workflow.
You don't have administrator access that is why the reset password function is not accessible by your login.
You can check the journal tab for more information. You will see an error which says "XTK-170020 Non authorized access to requested service (right 'admin' needed)."
Operators with admin access can run this code without any issues.
Thanks,
Manoj