diff --git a/build/start/change-service-timeout.bat b/build/start/change-service-timeout.bat new file mode 100644 index 0000000000..709d817dda --- /dev/null +++ b/build/start/change-service-timeout.bat @@ -0,0 +1,16 @@ +@echo off + +PUSHD %~dp0.. +call runasadmin.bat "%~dpnx0" + +POPD + +if %errorlevel% == 0 ( + pwsh %~dp0/command.ps1 "increase-service-timeout" +) + +echo. + +if "%1"=="nopause" goto start +pause +:start \ No newline at end of file diff --git a/build/start/command.ps1 b/build/start/command.ps1 index d542fc0239..8016eca574 100644 --- a/build/start/command.ps1 +++ b/build/start/command.ps1 @@ -2,14 +2,29 @@ $PSversionMajor = $PSVersionTable.PSVersion | sort-object major | ForEach-Object $PSversionMinor = $PSVersionTable.PSVersion | sort-object minor | ForEach-Object {$_.minor} if ($PSversionMajor -lt 7 -or $PSversionMinor -lt 2) { - Write-Error "Powershell version must be greater than or equal to 7.2. Press Enter to exit." - Pause + Write-Error "Powershell version must be greater than or equal to 7.2." exit } $WorkDir = "$(Split-Path -Parent $PSScriptRoot)\run"; $CommandName = "$($args[0])"; +if ( $CommandName -eq "increase-service-timeout" ) { + $RegistryPath = 'HKLM:\SYSTEM\CurrentControlSet\Control' + $Name = 'ServicesPipeTimeout' + $Value = '90000' + + Write-Output "Changing service start timeout from default value (30000 ms ) to $($Value) ms" + + New-ItemProperty -Path $RegistryPath -Name $Name -Value $Value -PropertyType DWORD -Force + + + Write-Warning "Please, restart the computer for the changes to take effect." + exit +} + + + #Write-Output "Starting $($CommandName) services at time: $(Get-Date -Format HH:mm:ss)" #Write-Output ""