Reply To: Custom script to change password on Windows

#12869
Zach GoodmanZach Goodman
Moderator
5 pts

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 –

 
net user Kiosk sey19ed1! /add /passwordreq:yes /times:monday-friday,8am-5pm /fullname:"Kiosk Display" 

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 –

 
net user Kiosk NewPassword 

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