Custom script to change password on WindowsSolved

Participant
Discussion
3 years ago

Is there a way to change password for Windows devices from Hexnode? We have some devices in kiosk for which we need to periodically change the password for security reason. I know Hexnode has the feature for password conditioning and all but what we need is a means to set the password ourselves.

Replies (2)

Marked SolutionPending Review
Participant
3 years ago
Marked SolutionPending Review

@zachgoodman, for me the ps1 script is not working but the .bat script works fine. Thank you for the answer. I think we could also use the ‘create user’ script.

Marked SolutionPending Review
Hexnode Expert
3 years ago
Marked SolutionPending Review

Hi @preston, you can do that with Hexnode’s Execute Custom Script for Windows feature. The feature allows you to remotely run a .bat, .cmd (for Command Prompt), or .ps1 (for PowerShell) script file on your Windows system with administrator privilege. With this feature, you can run the scripts on your system to change user passwords –

Scripts to change user password

I would recommend the .bat script over the .ps1 script as it is easier to get started. It uses the NET USER command-line tool that can be used to create, delete, modify or view user account information. You can even use the command to remotely create the local user account required for a multi-app kiosk –

The above code creates a new local user with the user account name as Kiosk. The mandatory password is set as sey19ed1! and the account will remain accessible from the system time – 8am till 5pm. The full name for the user is given as Kiosk Display and will be displayed as the user name on the lock screen. To change the password for the user ‘Kiosk’ you can similarly use the command –

This script will change the current password of the user ‘Kiosk’ to NewPassword. You can find more information about the NET USER command on Microsoft’s documentation.

Cheers!
Zach Goodman
Hexnode UEM