mirror of
https://github.com/dockur/windows.git
synced 2026-08-03 12:37:20 +01:00
98 lines
4.1 KiB
Batchfile
98 lines
4.1 KiB
Batchfile
@echo off
|
|
setlocal
|
|
|
|
set "SCRIPT_DIR=%~dp0"
|
|
set "SETUP_STARTED=%SCRIPT_DIR%setup.started"
|
|
set "SETUP_COMPLETE=%SCRIPT_DIR%setup.complete"
|
|
|
|
if "%~1"=="" goto setup
|
|
if /i "%~1"=="setup" goto setup
|
|
if /i "%~1"=="logon" goto logon
|
|
exit /b 2
|
|
|
|
:setup
|
|
if exist "%SETUP_COMPLETE%" exit /b 0
|
|
|
|
type nul > "%SETUP_STARTED%"
|
|
|
|
rem Allow guest access to network shares.
|
|
reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f
|
|
|
|
rem Disable the SMB signing requirement.
|
|
reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "RequireSecuritySignature" /t REG_DWORD /d 0 /f
|
|
|
|
rem Enable the option for passwordless sign-in.
|
|
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device" /v "DevicePasswordLessBuildVersion" /t REG_DWORD /d 0 /f
|
|
|
|
rem BEGIN LOCAL_ACCOUNT
|
|
rem Prevent the local user password from expiring.
|
|
powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive set-localuser -name "Docker" -passwordneverexpires 1
|
|
rem END LOCAL_ACCOUNT
|
|
|
|
rem Disable hibernation and monitor blanking.
|
|
POWERCFG -H OFF
|
|
POWERCFG -X -monitor-timeout-ac 0
|
|
|
|
rem Disable the first-run experience in Edge.
|
|
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "HideFirstRunExperience" /t REG_DWORD /d 1 /f
|
|
|
|
rem Disable hibernation in the registry.
|
|
reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateFileSizePercent" /t REG_DWORD /d 0 /f
|
|
reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Power" /v "HibernateEnabled" /t REG_DWORD /d 0 /f
|
|
|
|
rem Disable sleep.
|
|
POWERCFG -X -standby-timeout-ac 0
|
|
|
|
rem Allow RemoteApp to launch unlisted programs.
|
|
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "fAllowUnlistedRemotePrograms" /t REG_DWORD /d 1 /f
|
|
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList" /v "fDisabledAllowList" /t REG_DWORD /d 1 /f
|
|
|
|
rem Turn off automatic Windows Update downloads.
|
|
reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v "NoAutoUpdate" /t REG_DWORD /d 1 /f
|
|
|
|
rem Enable Network Discovery and File Sharing.
|
|
netsh advfirewall firewall set rule group="@FirewallAPI.dll,-32752" new enable=Yes
|
|
netsh advfirewall firewall set rule group="@FirewallAPI.dll,-28502" new enable=Yes
|
|
|
|
rem Remove the empty Windows.old folder.
|
|
if exist "%SystemDrive%\Windows.old" rd /q "%SystemDrive%\Windows.old"
|
|
|
|
rem Install the VirtIO Balloon service once.
|
|
sc.exe query BalloonService >nul 2>&1
|
|
if errorlevel 1 "%SystemRoot%\Drivers\Balloon\blnsvr.exe" -i
|
|
|
|
rem BEGIN PRODUCT_KEY
|
|
rem Install the product key without activating Windows immediately.
|
|
cscript.exe //B //Nologo "%SystemRoot%\System32\slmgr.vbs" /ipk "XXX"
|
|
rem END PRODUCT_KEY
|
|
|
|
rem Install the VirtIO display driver last to avoid disrupting earlier setup work.
|
|
pnputil.exe -i -a "%SystemRoot%\Drivers\viogpudo\viogpudo.inf"
|
|
|
|
type nul > "%SETUP_COMPLETE%"
|
|
exit /b 0
|
|
|
|
:logon
|
|
rem Run the machine setup here when SetupComplete.cmd was skipped.
|
|
if not exist "%SETUP_COMPLETE%" call "%~f0" setup
|
|
|
|
rem Set initial Explorer and taskbar preferences for the logged-in user.
|
|
reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowCopilotButton" /t REG_DWORD /d 0 /f
|
|
reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
|
|
reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowTaskViewButton" /t REG_DWORD /d 0 /f
|
|
reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarDa" /t REG_DWORD /d 0 /f
|
|
reg.exe add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarMn" /t REG_DWORD /d 0 /f
|
|
|
|
rem BEGIN SHARED_FOLDER
|
|
rem Add the shared folder to the desktop and map it to drive Z:.
|
|
if not exist "%USERPROFILE%\Desktop\Shared" mklink /d "%USERPROFILE%\Desktop\Shared" \\host.lan\Data
|
|
net.exe use Z: \\host.lan\Data /persistent:yes
|
|
rem END SHARED_FOLDER
|
|
|
|
rem BEGIN OEM_SCRIPT
|
|
rem Launch the custom script asynchronously in a separate visible window.
|
|
if exist "C:\OEM\install.bat" start "Install" cmd.exe /d /c ""C:\OEM\install.bat""
|
|
rem END OEM_SCRIPT
|
|
|
|
exit /b 0
|