Oleg_II Posted December 11, 2005 Share Posted December 11, 2005 (edited) Could somebody with batch scripting skills help to write the code for creating a user with HFSLIP? With choosing a user name and a password of cause It could be possibly included and run from HFSLIP.CMD.I used 3 methods for creating a user.1. Including in INSTALL.INF and placing in HFSVPK folder these lines: @echo offclsecho.echo Creating Windows Accountset /p UserName=Please enter a Name:set /p Pass=Please enter a Password:echo.echo Creating ...net user "%UserName%" "%Pass%" /addecho Adding ...net localgroup Administrators %UserName% /addnet accounts /maxpwage:unlimitedecho.rem Set to default user and user to autologon:@echo Windows Registry Editor Version 5.00> %SystemDrive%\Temp\logon.reg@echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]>> %SystemDrive%\Temp\logon.reg@echo "DefaultUserName"="%UserName%">> %SystemDrive%\Temp\logon.reg@echo "DefaultPassword"="%Pass%">> %SystemDrive%\Temp\logon.regregedit /s %SystemDrive%\Temp\logon.regexit The idea is good, especially with user name and password choosing. But something is going wrong with my installations - new user is created but he doesn't log during the first startup or is not a default user again. Edited December 14, 2005 by Oleg_II Link to comment Share on other sites More sharing options...
Tomcat76 Posted December 12, 2005 Share Posted December 12, 2005 (edited) How can I define this %UserName%?It was meant to be used inside Squeeto's batch file (as a replacement for the logon.reg file); %UserName% is defined in there. But he's using Windows 2000 and REG.EXE is not included by default so my version wouldn't work for him unless he added REG.EXE to his source.The first two lines in the code box of "my code" are already defined in the code box of Squeeto's code. Why not just add the third line to Squeeto's code and ditch mine?@echo "AutoAdminLogon"="1">> %SystemDrive%\Temp\logon.reg Edited December 12, 2005 by Tomcat76 Link to comment Share on other sites More sharing options...
Oleg_II Posted December 12, 2005 Author Share Posted December 12, 2005 Tomcat76 Thanx for replying. I've already got it (about %UserName%).But the general question - how to define Name and Password is still actuall. Adding %Password% (see this change in my post) helps during installation but something goes wrong and new user is not in the first logon Link to comment Share on other sites More sharing options...
Tomcat76 Posted December 12, 2005 Share Posted December 12, 2005 (edited) This is how I'd do it...@echo offnet user "Oleg 2" z /addnet localgroup Administrators "Oleg 2" /addnet accounts /maxpwage:unlimitedecho Windows Registry Editor Version 5.00>%SystemDrive%\Temp\logon.regecho [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]>>%SystemDrive%\Temp\logon.regecho "AutoAdminLogon"="1">>%SystemDrive%\Temp\logon.regecho "DefaultPassword"="">>%SystemDrive%\Temp\logon.regecho "DefaultUserName"="Oleg 2">>%SystemDrive%\Temp\logon.regecho "ForceAutoLogon"="1">>%SystemDrive%\Temp\logon.regregedit -s %SystemDrive%\Temp\logon.regexit(edited; forgot to include AutoAdminLogon) Edited December 12, 2005 by Tomcat76 Link to comment Share on other sites More sharing options...
Oleg_II Posted December 12, 2005 Author Share Posted December 12, 2005 (edited) Tomcat76Thanx. It should be working Will try it next time.I don't need force Autologon, I wand "Oleg 2" appears as default user during first start and I want to enter my password.And it could be a nice feature for HFSLIP too Edited December 12, 2005 by Oleg_II Link to comment Share on other sites More sharing options...
Bilou_Gateux Posted December 12, 2005 Share Posted December 12, 2005 (edited) Hi Oleg_IIHere the solution i use for Windows XP OS deployments:addacc.cmd@echo offrem Username and Password for administrator.set AdminUser=userset AdminPass=passwordrem Adding user.net user %AdminUser% %AdminPass% /add /active:yes /expire:never /passwordchg:no net localgroup Administrateurs %AdminUser% /addnet accounts /maxpwage:unlimitedactivate autologon for this new created userautologon user domain passwordpopulate RunOnceEX@echo offSET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExSET KEY1="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"REG ADD %KEY% /V TITLE /D "Pre-Installation" /fREG ADD %KEY%\000 /VE /D "Renaming computer" /f"REG ADD %KEY%\000 /V 1 /D "%temp%\zcnclite.exe /wmi:"""Win32_BIOS,SerialNumber""" /sn:"""HP-""" /q /forcerun /log:%temp%\ZCNC.LOG" /frem REG ADD %KEY%\002 /VE /D "Clear App Logs" /frem REG ADD %KEY%\002 /V 1 /D "%temp%\clearlogs.exe 127.0.0.1 -app" /frem REG ADD %KEY%\003 /VE /D "Clear Sys Logs" /frem REG ADD %KEY%\003 /V 1 /D "%temp%\clearlogs.exe 127.0.0.1 -sys" /fREG ADD %KEY%\004 /VE /D "Changing SID" /fREG ADD %KEY%\004 /V 1 /D "%temp%\newsid.exe /a" /frem REG ADD %KEY%\005 /VE /D "Application Install" /frem REG ADD %KEY%\005 /V 1 /D "%temp%\applaunch.exe" /fREG ADD %KEY%\007 /VE /D "AutoLogonOff" /fREG ADD %KEY%\007 /V 1 /D "%temp%\nircmd.exe regsetval sz \"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\" AutoAdminLogon 0"REG ADD %KEY%\008 /VE /D "CYT" /fREG ADD %KEY%\008 /V 1 /D "%temp%\cyt.exe /user:Bilou_Gateux /y /setprimary" /fREG ADD %KEY%\009 /VE /D "Network" /fREG ADD %KEY%\009 /V 1 /D "%temp%\nircmd exec \"%temp%\nbpshpop.exe +S: \\server\share\"" /fREG ADD %KEY%\010 /VE /D "CleanUp" /fREG ADD %KEY%\010 /V 1 /D "%temp%\delayexec \"%temp%\cleanup.exe /y /A /P:%temp% /Q\" 60" /fOne utility may be of some interest for you:Cover Your Tracks v2.30 (Cyt.exe) Last Updated: 11/29/2000 Allows you change the default user name shown at logon the prompt. Useful when you have logged into someone else's machine and you don't want them to lock out your account by typing in their password with your user ID. Requires the latest versions of the Microsoft Visual Basic 5 run-time files (MSKB 180071). Use 'Cyt /?' to view the syntax. Edited December 12, 2005 by Bilou_Gateux Link to comment Share on other sites More sharing options...
Oleg_II Posted December 14, 2005 Author Share Posted December 14, 2005 Bilou_Gateux Sorry for not replying earlier. I found interesting imformation in your post. Thank you very much!But unfortunatelly I can't get it working - during the first start Administrator is shown again but not a user I'm trying to define And I don't want to use any third party tools for this simple task. I'd better type once during first startup.And one question: net user %AdminUser% %AdminPass% /add /active:yes /expire:never /passwordchg:no - what means "/active:yes"? Does it intend to make this user default? Something changing all settings back to Administrator. Link to comment Share on other sites More sharing options...
tommyp Posted December 14, 2005 Share Posted December 14, 2005 /active:yes enables the account. If you changed it to /active:no, it would create the account but the user would not be able to sign in. There is another command called cacls which is used to set file/folder permissions. If you are going to set permissions on a folder that had previous permissions set, you need to clear the permissions first and then set them up to your liking. Link to comment Share on other sites More sharing options...
Squeeto Posted December 25, 2005 Share Posted December 25, 2005 (edited) Hey Oleg_II,I am a little late on this post.I modified the process again, a little.The setup prog asks for a unique computer name anyway so why ask it twice?At the time user.cmd runs, you have USERDOMAIN set to something like OLEG-12345 so:@echo offclsset | findstr USERDOMAIN>ztempFOR /F "TOKENS=2 DELIMS==-" %%I IN (ztemp) DO ( SET ZUSER=%%I )DEL /F /Q ztempecho Creating Windows Accountnet user %ZUSER% "" /addecho Adding ...net localgroup Administrators %ZUSER% /addnet accounts /maxpwage:unlimitedecho.rem Set to default user and user to autologon:@echo Windows Registry Editor Version 5.00> logon.reg@echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]>> logon.reg@echo "DefaultUserName"="%ZUSER%">> logon.reg@echo "AutoAdminLogon"="1">> logon.regregedit /s logon.regDEL /F /Q logon.regexitSo if you enter 'Oleg' as a unique computer name, your user name is OLEG.Not perfect but ok for now. Edited December 25, 2005 by Squeeto Link to comment Share on other sites More sharing options...
Oleg_II Posted December 25, 2005 Author Share Posted December 25, 2005 Squeeto Very interesting! Thanks!But are you sure you have USERDOMAIN set to something like OLEG-12345 so I never figured that Link to comment Share on other sites More sharing options...
Squeeto Posted December 26, 2005 Share Posted December 26, 2005 (edited) I can't remember how Fred's winnt.sif runs 'cause I have my own and half way through my install it asks me to enter a name. This name will be unique to my system and sets the initial USERDOMAIN environment variable.It doesn't (usually) end up as a login unless you install without the winnt.sif!I run my user.cmd initiated from the winnt.sif [GuiRunOnce] section. It runs after the unique name entry but before USERNAME is set. Interestingly, at this time the USERDOMAIN variable is set to my SQUEETO-HOME. I chop off the -HOME and use what's left for the logon.Recap:Unique name page - I enter Squeetosetup creates (on the same page) a Domain name of SQUEETO-454545 (a bunch of random numbers)I change the Domain to SQUEETO-HOME because it looks niceruser.cmd chops off the end and creates ...My three year old wants a bunch of happy faces so: These are her choices. Edited December 26, 2005 by Squeeto Link to comment Share on other sites More sharing options...
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