added tool for modifying autounattend.xml
This commit is contained in:
parent
12b2679bcd
commit
74e50dfa84
@ -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
|
||||
|
@ -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!
|
||||
|
||||
|
||||
|
@ -102,12 +102,12 @@
|
||||
<LocalAccount wcm:action="add">
|
||||
<Password>
|
||||
<!-- PASSWORD HERE -->
|
||||
<Value></Value>
|
||||
<Value>___MYPASS___</Value>
|
||||
<PlainText>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="support" set PasswordExpires=false</CommandLine>
|
||||
<CommandLine>cmd /C wmic useraccount where name="___MYUSER___" set PasswordExpires=false</CommandLine>
|
||||
</SynchronousCommand>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<Order>2</Order>
|
@ -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="support" set PasswordExpires=false</CommandLine>
|
||||
<CommandLine>cmd /C wmic useraccount where name="___MYUSER___" set PasswordExpires=false</CommandLine>
|
||||
</SynchronousCommand>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<Order>2</Order>
|
80
source/searchreplace.pb
Normal file
80
source/searchreplace.pb
Normal file
@ -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
|
2
tools/.gitignore
vendored
2
tools/.gitignore
vendored
@ -8,3 +8,5 @@
|
||||
!allpull.exe
|
||||
!simpletail.exe
|
||||
!installmonitor.exe
|
||||
!searchreplace.exe
|
||||
|
||||
|
BIN
tools/searchreplace.exe
Normal file
BIN
tools/searchreplace.exe
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user