Compare commits

..
2 Commits
Author SHA1 Message Date
dyoder 20cefe10b6 initial commit 2024-04-22 11:31:28 -04:00
dyoder 7c95440fd4 changed from current to default boot option 2024-04-22 11:31:16 -04:00
2 changed files with 33 additions and 2 deletions
+2 -2
View File
@@ -14,7 +14,7 @@ call :configure-service SplashtopRemoteService
:schedule-normal-reboot
call :reset-errorlevel
echo Configuring system to reboot into Normal Mode at next reboot
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Runonce" /v "*RestartNormalMode" /t REG_SZ /d "%SystemRoot%\System32\bcdedit.exe /deletevalue {current} safeboot" /f > nul 2>&1
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Runonce" /v "*RestartNormalMode" /t REG_SZ /d "%SystemRoot%\System32\bcdedit.exe /deletevalue {default} safeboot" /f > nul 2>&1
if %ERRORLEVEL% GTR 0 (
set /a REBOOT=%REBOOT%+1
echo ERROR: could not configure reboot into normal mode
@@ -22,7 +22,7 @@ if %ERRORLEVEL% GTR 0 (
:configure-reboot-safemodewithnetworking
call :reset-errorlevel
"%SystemRoot%\System32\bcdedit.exe" /set {current} safeboot network
"%SystemRoot%\System32\bcdedit.exe" /set {default} safeboot network
if %ERRORLEVEL% GTR 0 (
set /a REBOOT=%REBOOT%+1
echo ERROR: could not restart into Safe Mode with Networking
+31
View File
@@ -0,0 +1,31 @@
# List of services to configure
$Services = @(
"Syncro"
"SyncroLive"
"SyncroOvermind"
"SplashtopRemoteService"
)
# Configure necessary services to restart in Safe Mode with Networking
$Services | ForEach-Object {
If ( Get-Service $_ -ErrorAction SilentlyContinue ) {
Write-Output "Configuring ${_} service to start in Safe Mode with Networking"
Try { New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\${_}" -Force -ErrorAction SilentlyContinue }
Catch { Write-Error "ERROR: could not configure ${_} service to start in Safe Mode with Networking" ; Return }
}
}
# Configure system to reboot into Normal Mode at next reboot
Write-Output "Configuring system to reboot into Normal Mode at next reboot"
Try { [Microsoft.Win32.Registry]::SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Runonce",'*RestartNormalMode','%SystemRoot%\System32\bcdedit.exe /deletevalue {default} safeboot',[Microsoft.Win32.RegistryValueKind]::String) }
Catch { Write-Error "ERROR: could not configure reboot into normal mode" ; Return }
# Configure reboot into Safe Mode with Networking
Write-Output "Configuring system to reboot into Safe Mode with Networking"
Try { "%SystemRoot%\System32\bcdedit.exe" /set {default} safeboot network }
Catch { Write-Error "ERROR: could not configure reboot into safe mode with networking" ; Return }
# Reboot into Safe Mode with Networking
Write-Output "Rebooting into Safe Mode with Networking"
Try { Start-Sleep -Seconds 5 ; Restart-Computer -Force -ErrorAction Stop}
Catch { Write-Error "ERROR: could not reboot into safe mode with networking" ; Return }