Script to create a local account with administrator privileges


  1. Posts : 232
    Win 10 Ver 1903
       #1

    Script to create a local account with administrator privileges


    Is there a script using 'net user' or similar to create a local administrator account including password for Windows 10? I tried to put something together but apparently missed a step or have one out of order.

    The purpose is to give Users a way to create a 'backup' account to be used if they forget their password or any number of other problems that can prevent them from logging into their system; with their normal Microsoft Account.
    Rather than walk them through each step over the phone, I could email them a script to be run before the problems happen It would create a local admin account with a specific password that could be used in emergencies.

    This is for employees who have company systems but are seldom at the office and I would want to preload the name and password so they would not accidentally connect with it but it would be there and ready to use if they call for help.
    Can this still be done in Windows 10 if all the steps are in the right place?
      My Computer


  2. Posts : 17,661
    Windows 10 Pro
       #2

    A simple two line batch file does what you want to:

    Code:
    net user USERNAME PASSWORD /add
    net localgroup Administrators USERNAME /add

    Notice that the batch needs to be run elevated. Tutorials:


    Kari
      My Computer


  3. Posts : 232
    Win 10 Ver 1903
    Thread Starter
       #3

    :) Thanks! I see where i was losing my way now. Trying TOO hard.
    I was trying to get it all to run in one line and it kept failing. Two lines, no problems.
      My Computer


  4. Posts : 17,661
    Windows 10 Pro
       #4

    questorfla said:
    I was trying to get it all to run in one line and it kept failing. Two lines, no problems.
    Exactly. The account needs to be created first (line 1) before it can be added to Administrators group (line 2).
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 22:40.
Find Us




Windows 10 Forums