Merge branch 'develop' into bugfix/hide-menu

This commit is contained in:
Viktor Fomin 2022-11-07 16:59:22 +05:00
commit f6486d80b0
2 changed files with 33 additions and 2 deletions

View File

@ -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

View File

@ -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 ""