Custom script to change password on Windows

Preston
expand collapsive

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.

All Replies

  • Zach Goodman

    Zach Goodman

    Hexnode

    Zach Goodman

    Moderator

    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

  • Preston

    Preston

    Participant

    Preston

    Participant

    @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.