Need a Script to add local user

Posted on 2011-10-26
Last Modified: 2012-05-12
Need a powershell script or batch file that I can run during a light touch deployment (MDT) of Windows 7 that will add a LOCAL user, make the user auto login, and add a few IE favorites for that local user.

Question by:tfgeorge
    LVL 66

    Accepted Solution

    Untested, but I dont see why this wouldnt work.....

    Please test on a physical build first.....
    @echo off
    net user John P@ssw0rd /add
    REM Change Administrators to the group needed locally, or REM/Remove the line below
    net localgroup Administrators John /add
    REM Adding the Autologon....
    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "AutoAdminLogon" /d "1" /f
    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultPassword" /d "P@ssw0rd" /f
    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultUsername" /d "John" /f
    REM Adding a Runonce at logon to copy favorites.....
    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v "FavoritesCopy" /d "\\pathto\server\storingfavorites\favorites.bat" /f
    Save the following in "\\pathto\server\storingfavorites\" as favorites.bat
    @echo off
    copy  /Y "\\pathto\server\storingfavorites\*" "%userprofile%\Favorites\"

    Open in new window

    LVL 1

    Author Comment

    John, I'll play with it. The user needs to be NON-admin
    LVL 66

    Expert Comment

    Glad it worked....

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    This article shows how a content item can be identified directly or through translation of a navigation type. It then shows how this information can be used to create a menu for further navigation.
    In this previous article (, we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
    This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
    This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now