Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

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

- - - - -

  • Please log in to reply
23 replies to this topic

#1
BoardBabe

BoardBabe

    MSFN Expert

  • Member
  • PipPipPipPipPipPip
  • 1,419 posts
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?
BoardBabe


How to remove advertisement from MSFN

#2
druiddk

druiddk

    Member

  • Member
  • PipPip
  • 204 posts
Aye I always use regtweaks before adding users.
Please rate my post :)

#3
BoardBabe

BoardBabe

    MSFN Expert

  • Member
  • PipPipPipPipPipPip
  • 1,419 posts
Thank you. cmdlines.txt updated with the changes.

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

BoardBabe

#4
Doc Symbiosis

Doc Symbiosis

    Advanced Member

  • Member
  • PipPipPip
  • 333 posts
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, 22 January 2006 - 07:21 AM.


#5
BoardBabe

BoardBabe

    MSFN Expert

  • Member
  • PipPipPipPipPipPip
  • 1,419 posts
Ok, thanks. (It's not two batches though ;) )
BoardBabe

#6
twig123

twig123

    Advanced Member

  • Member
  • PipPipPip
  • 325 posts
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

#7
Doc Symbiosis

Doc Symbiosis

    Advanced Member

  • Member
  • PipPipPip
  • 333 posts
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.

#8
twig123

twig123

    Advanced Member

  • Member
  • PipPipPip
  • 325 posts
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

#9
BoardBabe

BoardBabe

    MSFN Expert

  • Member
  • PipPipPipPipPipPip
  • 1,419 posts
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, 22 January 2006 - 04:59 PM.

BoardBabe

#10
twig123

twig123

    Advanced Member

  • Member
  • PipPipPip
  • 325 posts
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

#11
BoardBabe

BoardBabe

    MSFN Expert

  • Member
  • PipPipPipPipPipPip
  • 1,419 posts
Hehe coasters are nice to have though!

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

#12
MHz

MHz

    Just simple

  • Member
  • PipPipPipPipPipPipPip
  • 1,653 posts
  • OS:Windows 7 x64
  • Country: Country Flag

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	EndIfEndFunc


#13
BoardBabe

BoardBabe

    MSFN Expert

  • Member
  • PipPipPipPipPipPip
  • 1,419 posts
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.
BoardBabe

#14
MHz

MHz

    Just simple

  • Member
  • PipPipPipPipPipPipPip
  • 1,653 posts
  • OS:Windows 7 x64
  • Country: Country Flag

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:

#15
RogueSpear

RogueSpear

    OS: SimplyMEPIS

  • MSFN Sponsor
  • 1,529 posts
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.lansweepe...ls/lsrunas.aspx

#16
BoardBabe

BoardBabe

    MSFN Expert

  • Member
  • PipPipPipPipPipPip
  • 1,419 posts
MHz: Ahh sorry, I though you compiled ;)

Well then it's just a matter of wha you preferre :D
BoardBabe

#17
twig123

twig123

    Advanced Member

  • Member
  • PipPipPip
  • 325 posts
ok... i've had an idea.... here is what I found:
I have made 2 versions of all the XP SP2 CD's (I dubbed Lite & Full)
My Lite edition just has windows updates slipstreamed, on the other hand, my Full also has BTS driver pack. I have found that my Lite edition works fine with the user creation on both VirtualPC & actual PC's, But my Full edition will only create the account under VirtualPC and NOT an actual PC... even though I use all of the same code files for both the full and light editions....
any other clues to what could be causing it?!

Thanks,
Dave

#18
twig123

twig123

    Advanced Member

  • Member
  • PipPipPip
  • 325 posts
more breaking news...
i recently discovered that my "full" CD's are registering the account name but there is no icon and doesn't show up under user contol panel. So, when I try to create the account as the same name my script should have it says something like... this user already has permission to use this system ( seems to be some sort of Guest account that I can't logon to unless i run the 'net user /delete' command)

??? baffeled ???
help! :P

~Dave

#19
twig123

twig123

    Advanced Member

  • Member
  • PipPipPip
  • 325 posts
@BoardBabe... I must be doing something horribly wrong... I still get the same results with your exact code!!!
I'm so confused....

Please help!

~Dave


p.s.
What version of XP are you using? Home or Pro... and OEM or Retail?

Edited by discountpc, 05 February 2006 - 08:43 AM.


#20
BoardBabe

BoardBabe

    MSFN Expert

  • Member
  • PipPipPipPipPipPip
  • 1,419 posts
I am using XP SP2 Pro.
BoardBabe

#21
twig123

twig123

    Advanced Member

  • Member
  • PipPipPip
  • 325 posts
Recompiled my cd's... again... so far Pro seems to work under VirtualPC still... but Home will not create the account, even though it tries to auto-logon.

...any one else having this issue?

~Dave

#22
twig123

twig123

    Advanced Member

  • Member
  • PipPipPip
  • 325 posts
Okay... I think I got around the user issue in Home Ed.
... I had to use the OOBEINFO.INI Method instead of the NET USER Method... and it is now working in VirtualPC... time to make some more coasters :P
I'll post with my results.

#23
twig123

twig123

    Advanced Member

  • Member
  • PipPipPip
  • 325 posts
Ok, so XP Home seems to like only the OOBE user account method... but Pro seems to work either way...
go figure...

long story short, it works now with the OOBE method... but my .NET 1.1 doesn't install anymore, I must have goofed something else up :unsure: but I'm sure I can figure that out.

Thanks for all the help!
~Dave

#24
Djé

Djé

    accent artist

  • Member
  • PipPipPip
  • 359 posts
@discountpc
I don't know if you solved all your problems but I read you're trying to register a new user called 'Owner'.
Why not but if you want to debug something about user registration, I would strongly advise to use something else than 'Owner' as a user login: this one is used by windows anyway if you don't provide a user: no Net user xxx /add in your scripts AND bypass OOBE in winnt.sif (don't remember if it is 'skipwelcome=yes' or 'unattendswitch=yes').
Use another name if you want to know what is happening. With that one, you'll never know if it comes from your script or from windows' default.
Those who do not learn from History are doomed to repeatedly fail their History exams.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN