USB Installation Stick not found by System Installation #50

This commit is contained in:
Michael H.G. Schmidt 2022-12-24 15:56:30 +01:00
parent 7f656f7bf3
commit 090046384a
5 changed files with 96 additions and 32 deletions

View File

@ -0,0 +1,12 @@
@echo off
set TOOLS=c:\tools
net session >nul 2>&1
if NOT %ERRORLEVEL% == 0 (
echo ERROR: User has NO ADMINISTRATOR rights!
exit /b
)
echo disabling unwanted NETWORK features ...
powershell -command %TOOLS%\scripts\disable-networkfeatures.ps1

34
source/prompt-user.pb Normal file
View File

@ -0,0 +1,34 @@
; prompt-user.pb
; ------------------------------------------------------------
; this tool displays a message requester showing a custom text
; LICENSE : GPL
; AUTHOR : Michael H.G. Schmidt
; EMAIL : michael@schmidt2.de
; DATE : 20221224
; ------------------------------------------------------------
;
OpenConsole()
; check commandline ...
If ( CountProgramParameters() <> 1 )
ConsoleColor(14,0)
PrintN("")
PrintN("usage: prompt-user <message>")
PrintN("")
ConsoleColor(15,0)
PrintN("show a message for the user")
ConsoleColor(7,0)
PrintN("")
End 99
EndIf
; get arguments ...
message$ = ProgramParameter(0)
MessageRequester("System Message", message$, #PB_MessageRequester_Info| #PB_MessageRequester_Info)
; IDE Options = PureBasic 5.73 LTS (Windows - x64)
; CursorPosition = 30
; EnableXP

View File

@ -225,15 +225,17 @@ reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer" ^
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer" ^ reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer" ^
/v "ShowFrequent" /t REG_DWORD /d 0 /f 1>nul /v "ShowFrequent" /t REG_DWORD /d 0 /f 1>nul
echo disabling unwanted NETWORK features ... rem try to disable unwanted network features
powershell -command %TOOLS%\scripts\disable-networkfeatures.ps1 call %TOOLS%\scripts\disable-networkfeatures.cmd
rem try to cleanup the tiles in the start menu (only for admins) rem try to cleanup the tiles in the start menu (only for admins)
call %TOOLS%\scripts\cleanup-tiles.cmd call %TOOLS%\scripts\cleanup-tiles.cmd
rem ========= echo.
rem SEAFILE echo =========
rem ========= echo SEAFILE
echo =========
echo.
echo setting path for SEAFILE files ... echo setting path for SEAFILE files ...
reg add "HKEY_CURRENT_USER\SOFTWARE\SeaFile" ^ reg add "HKEY_CURRENT_USER\SOFTWARE\SeaFile" ^
@ -250,23 +252,8 @@ if seafile_domain == 0 (
/v "PreconfigureUserToken" /d "null" /t REG_SZ /f 1>nul /v "PreconfigureUserToken" /d "null" /t REG_SZ /f 1>nul
) )
rem create a statusfile (this codeblock must be executed only once per user) ...
echo 1 >%USERCONFIG_DONE%
:USERTWEAKS_DONE
rem ========================================
rem ACCOUNT CLEANUP AND FIXES (runs always)
rem ========================================
echo. echo.
echo ##### echo reorganizing start menu and desktop
echo ##### CLEANING ...
echo #####
echo.
echo Reorganizing start menu and desktop ...
echo ######################################## echo ########################################
echo. echo.
@ -293,11 +280,6 @@ echo Removing microsoft edge links in start menu...
del /F %STARTMENU%\"Microsoft Edge.lnk" 2>nul del /F %STARTMENU%\"Microsoft Edge.lnk" 2>nul
del /F %USERPROFILE%\"Desktop\Microsoft Edge.lnk" 2>nul del /F %USERPROFILE%\"Desktop\Microsoft Edge.lnk" 2>nul
rem ... stupid OS problem #7
rem Rewards ? Really ? Seriously ?
echo Disabling nag screen in windows settings ...
%TOOLS%\vivetool delconfig 18299130 1
rem IE too! rem IE too!
echo Removing IE links in start menu, sigh ... echo Removing IE links in start menu, sigh ...
del /F %STARTMENU%\"Accessories\Internet Explorer.lnk" 2>nul del /F %STARTMENU%\"Accessories\Internet Explorer.lnk" 2>nul
@ -310,16 +292,42 @@ rd /S /Q %STARTMENU%\"Administrative Tools" 2>nul
rd /S /Q %STARTMENU%\"Maintenance" 2>nul rd /S /Q %STARTMENU%\"Maintenance" 2>nul
rd /S /Q %STARTMENU%\"System Tools" 2>nul rd /S /Q %STARTMENU%\"System Tools" 2>nul
rd /S /Q %STARTMENU%\"Windows Powershell" 2>nul rd /S /Q %STARTMENU%\"Windows Powershell" 2>nul
rem create a statusfile (this codeblock must be executed only once per user) ...
echo 1 >%USERCONFIG_DONE%
:USERTWEAKS_DONE
rem ========================================
rem ACCOUNT CLEANUP AND FIXES (runs always)
rem ========================================
echo.
echo #####
echo ##### CLEANUP
echo #####
echo.
echo ... user settings
echo ########################################
echo.
rem ... stupid OS problem #7
rem Rewards ? Really ? Seriously ?
echo Disabling nag screen in windows settings ...
%TOOLS%\vivetool delconfig 18299130 1
echo.
echo ... users home directory
echo ########################################
echo. echo.
rem WARNING! rem WARNING!
rem DO NOT remove the "PICTURES" folder! rem DO NOT remove the "PICTURES" folder!
rem this is used and needed by the snipping tool! rem this is used and needed by the snipping tool!
echo Cleaning users home directory ...
echo ########################################
echo.
echo 3D Objects ... echo 3D Objects ...
rd /S /Q %USERPROFILE%\"3D Objects" 2>nul rd /S /Q %USERPROFILE%\"3D Objects" 2>nul
@ -351,10 +359,14 @@ for %%D in (
) )
echo creating Pictures folder for Snipping Tool ... echo.
echo OTHER tasks and fixes for the user
echo ########################################
echo.
echo Creating pictures folder for snipping tool ...
mkdir %USERPROFILE%\Pictures 2>nul mkdir %USERPROFILE%\Pictures 2>nul
echo.
echo Starting workstation service ... echo Starting workstation service ...
net start workstation 1>nul 2>nul net start workstation 1>nul 2>nul
net config workstation net config workstation

View File

@ -10,6 +10,8 @@ date /t
time /t time /t
echo. echo.
rem scan for the USB stick (infinite) ...
:loop
for %%D in (A B D E F G H I J K L M N O P Q R S T U V W X Y Z) do ( for %%D in (A B D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
if EXIST %%D:\%BATCH% ( if EXIST %%D:\%BATCH% (
@ -19,9 +21,12 @@ for %%D in (A B D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
GOTO END GOTO END
) else ( ) else (
echo INFO: %BATCH% not found on drive %%D! echo INFO: %BATCH% not found on drive %%D!
echo INFO: Calling the GUI helper to prompt the user to use a different USB port ...
prompt-user "Custom setup script NOT found! Please disconnect the USB stick and connect it to another USB port. Then click on OK."
) )
) )
goto loop
:END :END

View File

@ -17,6 +17,7 @@ mkdir %IMAGE%\Windows\Setup\scripts 1>nul 2>nul
echo [%0] INFO: copying scripts to %IMAGE%\Windows\Setup\scripts ... echo [%0] INFO: copying scripts to %IMAGE%\Windows\Setup\scripts ...
copy /Y SetupComplete.cmd %IMAGE%\Windows\Setup\scripts copy /Y SetupComplete.cmd %IMAGE%\Windows\Setup\scripts
copy /Y StartCustomSetup.cmd %IMAGE%\Windows\Setup\scripts copy /Y StartCustomSetup.cmd %IMAGE%\Windows\Setup\scripts
copy /Y ..\tools\prompt-user.exe %IMAGE%\Windows\Setup\scripts
if %ERRORLEVEL% NEQ 0 ( if %ERRORLEVEL% NEQ 0 (
echo [%0] ERROR: while copying scripts to IMAGE echo [%0] ERROR: while copying scripts to IMAGE
exit /b exit /b