BoardBabe Posted January 21, 2006 Posted January 21, 2006 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?
druiddk Posted January 21, 2006 Posted January 21, 2006 Aye I always use regtweaks before adding users.
BoardBabe Posted January 22, 2006 Author Posted January 22, 2006 Thank you. cmdlines.txt updated with the changes.[COMMANDS]"REGEDIT /S SystemSettings.reg""Useraccount.cmd"
Doc Symbiosis Posted January 22, 2006 Posted January 22, 2006 (edited) 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 January 22, 2006 by Doc Symbiosis
BoardBabe Posted January 22, 2006 Author Posted January 22, 2006 Ok, thanks. (It's not two batches though )
twig123 Posted January 22, 2006 Posted January 22, 2006 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 /addnet localgroup Administrators Owner /addnet accounts /maxpwage:unlimitedREGEDIT /S autologon.regThank You,Dave
Doc Symbiosis Posted January 22, 2006 Posted January 22, 2006 Use the start /wait command when you run the commands. This could spare you some trouble. start "add user" /wait net user Owner /addstart "add to administrators" /wait net localgroup Administrators Owner /addstart "set maximum password age to unlimited" /wait net accounts /maxpwage:unlimitedstart "set autorun" /wait REGEDIT /S autologon.regI 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.
twig123 Posted January 22, 2006 Posted January 22, 2006 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
BoardBabe Posted January 22, 2006 Author Posted January 22, 2006 (edited) 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=BoardBabeset AdminPass=: ---------------------- Config end. ---------------------: Adding user.net user %AdminUser% %AdminPass% /addnet localgroup Administratorer %AdminUser% /addnet accounts /maxpwage:unlimited: Activating AutoLogon.reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultUserName" /d "%AdminUser%" /freg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultPassword" /d "%AdminPass%" /freg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "AutoAdminLogon" /d "1" /fexit Edited January 22, 2006 by BoardBabe
twig123 Posted January 23, 2006 Posted January 23, 2006 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
BoardBabe Posted January 23, 2006 Author Posted January 23, 2006 Hehe coasters are nice to have though! Save my file as a .cmd and run it from cmdlines.txt, no need for autlogon.reg.
MHz Posted January 23, 2006 Posted January 23, 2006 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
BoardBabe Posted January 23, 2006 Author Posted January 23, 2006 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.
MHz Posted January 26, 2006 Posted January 26, 2006 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. As for changing name, simple:_NetUser('MHz', '', '', 1)I think you misjudged, I compile nothing.
RogueSpear Posted January 26, 2006 Posted January 26, 2006 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now