Compare commits

..
3 Commits
Author SHA1 Message Date
dyoder ba99f71d26 initial upload 2022-07-14 13:25:54 -04:00
dyoder b703f6a9b6 major overhaul 2022-07-14 13:25:37 -04:00
dyoder 7febd26ad4 initial upload 2022-07-14 13:25:18 -04:00
3 changed files with 68 additions and 38 deletions
+11
View File
@@ -0,0 +1,11 @@
@echo off
setlocal
cls
call :configure-service AteraAgent
call :configure-service SplashtopRemoteService
goto :EOF
:configure-service
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\%*" /f
goto :EOF
+42 -38
View File
@@ -1,60 +1,64 @@
@echo off @echo off
setlocal enabledelayedexpansion setlocal
cls cls
rem Temporary file to store the services we'll need to enable
set FILENAME=safebootservices.txt
rem List of services that need to be started in Safe Mode with Networking
echo AteraAgent> %FILENAME%
echo Splashtop Inc.>> %FILENAME%
echo SplashtopRemoteService>> %FILENAME%
echo.
echo Configuring required services to automatically start in Safe Mode with Networking
set /a REBOOT=0 set /a REBOOT=0
for /f "delims=" %%G in (%FILENAME%) do ( echo.
set SERVICE=%%G echo Configuring required services to automatically start in Safe Mode with Networking.
call :reset-errorlevel call :configure-service AteraAgent
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\!SERVICE!" /f > nul 2>&1 call :configure-service SplashtopRemoteService
if !ERRORLEVEL! GTR 0 (
echo ERROR: could not configure "!SERVICE!" service to start in Safe Mode with Networking
set /a REBOOT=!REBOOT!+1
)
)
:schedule-normal-reboot
call :reset-errorlevel 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 {current} safeboot" /f > nul 2>&1
if %ERRORLEVEL% GTR 0 ( if %ERRORLEVEL% GTR 0 (
echo ERROR: could not configure reboot into normal mode
set /a REBOOT=%REBOOT%+1 set /a REBOOT=%REBOOT%+1
echo ERROR: could not configure reboot into normal mode
) )
if %REBOOT% EQU 0 goto :reboot :configure-reboot-safemodewithnetworking
goto :end-error
:reboot
call :reset-errorlevel call :reset-errorlevel
"%SystemRoot%\System32\bcdedit.exe" /set {current} safeboot network "%SystemRoot%\System32\bcdedit.exe" /set {current} safeboot network
if %ERRORLEVEL% EQU 0 ( if %ERRORLEVEL% GTR 0 (
shutdown /r /f /t 10 set /a REBOOT=%REBOOT%+1
echo Restarting in 10 seconds echo ERROR: could not restart into Safe Mode with Networking
goto :end
) else (
echo ERROR: could not restart in Safe Mode with Networking
goto :end-error
) )
:reboot
if %REBOOT% EQU 0 (
shutdown /r /f /t 5
goto :end-success
)
goto :end-error
:configure-service
call :reset-errorlevel
sc query | findstr /I "SERVICE_NAME: %*" >nul
if %ERRORLEVEL% EQU 0 (
echo Enabling %* to startup in Safe Mode with Networking
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\%*" /f
) else (
set /a REBOOT=%REBOOT%+1
echo ERROR: could not configure %* service to start in Safe Mode with Networking
)
goto :EOF
:reset-errorlevel
cmd /c "exit /b 0"
goto :EOF
:end-success
echo Successfully scheduled a reboot into Safe Mode with Networking
exit /B 0
goto :end
:end-error :end-error
echo. echo.
echo Errors were encountered and the system will not be restarted echo Errors were encountered and the system will not be restarted
echo Please make sure this script is run with administrative privileges echo Please make sure this script is run with administrative privileges
exit /B %REBOOT%
goto :end goto :end
:end :end
del /f %FILENAME%
goto :EOF
:reset-errorlevel
cmd /c "exit /b 0"
+15
View File
@@ -0,0 +1,15 @@
# Specify the URL to download the app from
$URL = 'https://downloads.simpleinout.com/desktop/Simple-In-Out.msi'
# Download the installer
$INSTALLER = Download-File -URL $URL
# Install the app
LogMsg "Installing latest version of Simple In/Out from ""${INSTALLER}"""
Try { Start-Process "msiexec.exe" -ArgumentList "/i ${INSTALLER} /qn /norestart" -Wait }
Catch { LogErr $_.Exception.Message }
# Delete the installer
LogMsg "Deleting downloaded installer from ""${INSTALLER}"""
Try { Remove-Item -Path $INSTALLER -Force -ErrorAction SilentlyContinue }
Catch { LogErr $_.Exception.Message }