Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

cmdlines.txt, what goes first regtweaks or adduser batch?

Featured Replies

In my cmdlines.txt i have a batch that adds the admin user and a regtweaks file. In what order should these be run? At the moment the first entry is adduser.cmd and then regtweaks.reg, but should maybe regtweaks really be first?? So that all the HKCU entries will be added to the HKU\s-1-5-21xxx the adduser.cmd creates?


  • Author

Thank you. cmdlines.txt updated with the changes.

[COMMANDS]
"REGEDIT /S SystemSettings.reg"
"Useraccount.cmd"

It doesn't make any difference, which of these two batches you run first, cause the HKCU regtweaks aren't applied to admin until his first login, so after the next restart. Therefore the order isn't important.

Edited by Doc Symbiosis

as long as we are on the subject, I am having some issues with this exact thing. I setup my disk to do autocreate & logon to an account called "Owner" but it doesn't seem to create the account even though it tries to logon to the account that it didn't create after windows install is complete.... funny thing is, is that I test all of my CD's out on VirtualPC '04... and it actually creates the account how it should there!... if I burn the same exact image and install on an actual PC... no user account is created! I am trying to create the Owner account with no password... and what I cant figure out is why it would work in VirtualPC but not on a actual PC... all the code is the same.

... I need some help, because I am baffled.

here is what my code looks like:

net user Owner /add

net localgroup Administrators Owner /add

net accounts /maxpwage:unlimited

REGEDIT /S autologon.reg

Thank You,

Dave

Use the start /wait command when you run the commands. This could spare you some trouble.

start "add user" /wait net user Owner /add
start "add to administrators" /wait net localgroup Administrators Owner /add
start "set maximum password age to unlimited" /wait net accounts /maxpwage:unlimited
start "set autorun" /wait REGEDIT /S autologon.reg

I have had similar problems, e.g. that the added user was added to the administrators-group on a virtual machine, but not in a real installation.

thats interesting... I never thought that it would be exicuting the code too fast... but when I get off of work tonight I will test it.

... is this how you have your existing code setup?

~Dave

  • Author

Here is my exact code setup... It has never failed...

cmdow @ /HID
@echo off

: --------------------- Config start. --------------------

: Set username (and password, optional) for admin user.
set AdminUser=BoardBabe
set AdminPass=

: ---------------------- Config end. ---------------------

: Adding user.
net user %AdminUser% %AdminPass% /add
net localgroup Administratorer %AdminUser% /add
net accounts /maxpwage:unlimited

: Activating AutoLogon.
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultUserName" /d "%AdminUser%" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultPassword" /d "%AdminPass%" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "AutoAdminLogon" /d "1" /f

exit

Edited by BoardBabe

Thanks for trying to help Doc, but much to my dismay... it still will not create the Owner account on an actual PC, but on the other hand... it still works in VirualPC.... :-|

@BoardBabe: thanks for the input, I will test this code as soon as i grab another spindle of cd's (too many coasters trying to get the logon to work... even though it works in VirtualPC).

I will test and let you all know asap how the progress is coming.

~Dave

  • Author

Hehe coasters are nice to have though!

Save my file as a .cmd and run it from cmdlines.txt, no need for autlogon.reg.

Hehe coasters are nice to have though!

Save my file as a .cmd and run it from cmdlines.txt, no need for autlogon.reg.

Nice. I see it looks tidy, organized and correct. Good to see the Set command being used to benefit the script.

I do an all in one function in AutoIt as well. Why not indeed. :)

Func _NetUser($name, $password = '', $groupname = '', $autologon = 0)
If $groupname = '' Then $groupname = 'Administrators'
Local $key
If Not FileExists(EnvGet('AllUsersProfile') & '\..\' & $name) Then
RunWait(@ComSpec & ' /c ' & _
'Net User ' & $name & ' ' & $password & ' /add &&' & _
'Net LocalGroup ' & $groupname & ' ' & $name & ' /add &' & _
'Net Accounts /MaxPwAge:UnLimited', '', @SW_HIDE)
If $autologon Then
$key = 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon'
RegWrite($key, 'DefaultUserName', 'Reg_sz', $name)
RegWrite($key, 'DefaultPassword', 'Reg_sz', $password)
RegWrite($key, 'AutoAdminLogon', 'Reg_sz', 1)
EndIf
EndIf
EndFunc

  • Author

Indeed MHz, verry good script!

I am using .cmd as I find it just a little simpler to edit when I need to change the username/password.

Indeed MHz, verry good script!

I am using .cmd as I find it just a little simpler to edit when I need to change the username/password.

Thanks.

But last time I checked my project folder, my scripts are plain text files also. :w00t:

As for changing name, simple:

_NetUser('MHz', '', '', 1)

I think you misjudged, I compile nothing. :rolleyes:

Just as a matter of interest.. if you'd like to be able to manipulate accounts and passwords and not have the passwords in plain text, there's a nice little command line utility called Supercrypt (used to be called lsrunas). I don't have very much need for it, but when I do it's a lifesaver.

http://www.lansweeper.com/ls/lsrunas.aspx

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.