Jump to content

Recommended Posts

Posted

I create the admin userprofile from a .cmd that runs from cmdlines.txt

cmdow @ /HID
@echo off

set ADMINRIGHTS=SuperDude

net user %ADMINRIGHTS% /add
net localgroup Administratorer %ADMINRIGHTS% /add
net accounts /maxpwage:unlimited

REGEDIT /S Autologon1.reg

EXIT

To ensure that this user is autologgedon the first time, so that WPI will run and install to this user I apply Autologon1.reg that enables autologon in the registry, for this user.

Autologon1.reg

Windows Registry Editor Version 5.00 

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"DefaultUserName"="SuperDude"
"DefaultPassword"=""
"AutoAdminLogon"="1"

How can I apply this regtweak directly from the cmd file without calling an external .reg file? So that I can use the variable for "DefaultUserName"="%ADMINRIGHTS%"

I need this Cause I change usernames alot :)


Posted (edited)

cmdow @ /HID
@echo off

set ADMINRIGHTS=SuperDude
set KEY="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"

net user %ADMINRIGHTS% /add
net localgroup Administratorer %ADMINRIGHTS% /add
net accounts /maxpwage:unlimited

reg add %KEY% /v DefaultUserName /t REG_SZ /d %ADMINRIGHTS% /f
reg add %KEY% /v DefaultPassword /t REG_SZ /d "" /f
reg add %KEY% /v AutoAdminLogon /t REG_SZ /d 1 /f

That should do it. ;)

If required, just add "" to where you think a space maybe in a string.

Edited by MHz

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...