Sign in to follow this  
Followers 0
BoardBabe

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

24 posts in this topic

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?

0

Share this post


Link to post
Share on other sites

Thank you. cmdlines.txt updated with the changes.

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

0

Share this post


Link to post
Share on other sites

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
0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites

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
0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites

Hehe coasters are nice to have though!

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

0

Share this post


Link to post
Share on other sites
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

0

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites
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:

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.