diff --git a/06_Copy2Stick.cmd b/06_Copy2Stick.cmd index 2cbb70a..a01f60c 100644 --- a/06_Copy2Stick.cmd +++ b/06_Copy2Stick.cmd @@ -34,18 +34,41 @@ set answer= set /p answer="BIOS or UEFI setup (B/U)? " if /i "%answer:~,1%" EQU "B" ( echo selected: BIOS - copy /Y boot\autounattend_BIOS.xml %USBDRIVE%\autounattend.xml + copy /Y boot\autounattend_BIOS_template.xml %USBDRIVE%\autounattend.xml GOTO CONT ) if /i "%answer:~,1%" EQU "U" ( echo selected: UEFI - copy /Y boot\autounattend_UEFI.xml %USBDRIVE%\autounattend.xml + copy /Y boot\autounattend_UEFI_template.xml %USBDRIVE%\autounattend.xml GOTO CONT ) echo Please type B for BIOS or U for UEFI setup. goto ask :CONT +rem ask for user ... +echo. +set MYUSER=support +set /p MYUSER="Username (%MYUSER%)? " +echo MYUSER = %MYUSER% + +rem ask for real name ... +echo. +set MYNAME="Support User" +set /p MYNAME="Display Name (%MYNAME%)? " +echo MYNAME = %MYNAME% + +rem ask for a password ... +echo. +set MYPASS= +set /p MYPASS="Password (not set)? " +echo MYPASS = %MYPASS% + +echo. +tools\searchreplace %USBDRIVE%\autounattend.xml ___MYUSER___ %MYUSER% +tools\searchreplace %USBDRIVE%\autounattend.xml ___MYNAME___ %MYNAME% +tools\searchreplace %USBDRIVE%\autounattend.xml ___MYPASS___ %MYPASS% + echo. echo copying [ %BOOT% ] to drive %USBDRIVE% ... robocopy %SOURCES% %USBDRIVE%\sources %BOOT% /J /NJH diff --git a/README.md b/README.md index 0cf99db..21d62a9 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Finally, there is the problem of obesity. Modern systems are getting fatter, slo # **Please read this to get started!** **IMPORTANT:** -This whole thing was crafted and tested with Windows 10 version 20H2. +This whole thing was crafted and tested with Windows 10 version 20H2 v1 english, 64-bit. This is actually the only *supported* version! diff --git a/boot/autounattend_BIOS.xml b/boot/autounattend_BIOS_template.xml similarity index 94% rename from boot/autounattend_BIOS.xml rename to boot/autounattend_BIOS_template.xml index 5eaaf7a..e0f8521 100644 --- a/boot/autounattend_BIOS.xml +++ b/boot/autounattend_BIOS_template.xml @@ -102,12 +102,12 @@ - + ___MYPASS___ true</PlainText> </Password> <!-- USERNAME HERE --> - <DisplayName>support</DisplayName> - <Name>support</Name> + <DisplayName>___MYNAME___</DisplayName> + <Name>___MYUSER___</Name> <Group>Administrators</Group> </LocalAccount> </LocalAccounts> @@ -115,19 +115,19 @@ <AutoLogon> <Password> <!-- PASSWORD HERE --> - <Value></Value> + <Value>___MYPASS___</Value> <PlainText>true</PlainText> </Password> <Enabled>true</Enabled> <LogonCount>1</LogonCount> <!-- USERNAME HERE --> - <Username>support</Username> + <Username>___MYUSER___</Username> </AutoLogon> <FirstLogonCommands> <SynchronousCommand wcm:action="add"> <Order>1</Order> <Description>Password Never Expires</Description> - <CommandLine>cmd /C wmic useraccount where name=&quot;support&quot; set PasswordExpires=false</CommandLine> + <CommandLine>cmd /C wmic useraccount where name=&quot;___MYUSER___&quot; set PasswordExpires=false</CommandLine> </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>2</Order> diff --git a/boot/autounattend_UEFI.xml b/boot/autounattend_UEFI_template.xml similarity index 93% rename from boot/autounattend_UEFI.xml rename to boot/autounattend_UEFI_template.xml index 77226b0..1071b2e 100644 --- a/boot/autounattend_UEFI.xml +++ b/boot/autounattend_UEFI_template.xml @@ -122,12 +122,12 @@ <LocalAccount wcm:action="add"> <Password> <!-- PASSWORD HERE --> - <Value></Value> - <PlainText>false</PlainText> + <Value>___MYPASS___</Value> + <PlainText>true</PlainText> </Password> - <DisplayName>support</DisplayName> + <DisplayName>___MYNAME___</DisplayName> <!-- USERNAME HERE --> - <Name>support</Name> + <Name>___MYUSER___</Name> <Group>Administrators</Group> </LocalAccount> </LocalAccounts> @@ -135,19 +135,19 @@ <AutoLogon> <Password> <!-- PASSWORD HERE --> - <Value></Value> - <PlainText>false</PlainText> + <Value>___MYPASS___</Value> + <PlainText>true</PlainText> </Password> <Enabled>true</Enabled> <LogonCount>1</LogonCount> <!-- USERNAME HERE --> - <Username>support</Username> + <Username>___MYUSER___</Username> </AutoLogon> <FirstLogonCommands> <SynchronousCommand wcm:action="add"> <Order>1</Order> <Description>Password Never Expires</Description> - <CommandLine>cmd /C wmic useraccount where name=&quot;support&quot; set PasswordExpires=false</CommandLine> + <CommandLine>cmd /C wmic useraccount where name=&quot;___MYUSER___&quot; set PasswordExpires=false</CommandLine> </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>2</Order> diff --git a/source/searchreplace.pb b/source/searchreplace.pb new file mode 100644 index 0000000..9210def --- /dev/null +++ b/source/searchreplace.pb @@ -0,0 +1,80 @@ +; searchreplace.pb +; ------------------------------------------------------------ +; search a string in a file and replace all occurences +; LICENSE : GPL +; AUTHOR : Michael H.G. Schmidt +; EMAIL : michael@schmidt2.de +; DATE : 20210328 +; ------------------------------------------------------------ +; + +OpenConsole() + +; check commandline ... +If ( CountProgramParameters() <> 3 ) + ConsoleColor(14,0) + PrintN("") + PrintN("usage: searchreplace <filename> <oldstring> <newstring>") + PrintN("") + ConsoleColor(15,0) + PrintN("search a string in a file and replace all occurences") + PrintN(" oldstring: string to search") + PrintN(" newstring: string to replace") + ConsoleColor(7,0) + PrintN("") + End 99 +EndIf + +; get arguments ... +workfile$ = ProgramParameter(0) +oldstring$ = ProgramParameter(1) +newstring$ = ProgramParameter(2) + +; vars +tempfile$ = workfile$ + "_T" + +; +; MAIN +; + +; open workfile ... +If Not ReadFile(0, workfile$, #PB_File_SharedRead | #PB_File_NoBuffering) + PrintN("ERROR while opening file [ " + workfile$ + " ] for reading!") + End 99 +EndIf + +; cleanup ... +DeleteFile(tempfile$,#PB_FileSystem_Force) + +; open tempfile ... +If Not OpenFile(1, tempfile$, #PB_File_SharedWrite | #PB_File_NoBuffering) + PrintN("ERROR while opening tempfile [ " + tempfile$ + " ] for writing!") + End 99 +EndIf + +PrintN("working on [ "+ workfile$ +" ] and replacing string [ "+ oldstring$ +" ] With [ "+ newstring$ +" ] ...") +Repeat + ; read a line ... + line$ = ReadString(0) + + ; search and replace ... + result$ = ReplaceString(line$, oldstring$, newstring$) + + ; write to tempfile ... + WriteStringN(1, result$) +Until Eof(0) + +; close files ... +CloseFile(0) +CloseFile(1) + +; delete workfile ... +DeleteFile(workfile$,#PB_FileSystem_Force) + +; move tempfile in place of original file ... +dummy = RenameFile(tempfile$, workfile$) + +; IDE Options = PureBasic 5.73 LTS (Windows - x64) +; CursorPosition = 54 +; FirstLine = 30 +; EnableXP \ No newline at end of file diff --git a/tools/.gitignore b/tools/.gitignore index 1367f13..f647771 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -8,3 +8,5 @@ !allpull.exe !simpletail.exe !installmonitor.exe +!searchreplace.exe + diff --git a/tools/searchreplace.exe b/tools/searchreplace.exe new file mode 100644 index 0000000..5df9e68 Binary files /dev/null and b/tools/searchreplace.exe differ