2
0

Remove Files After Install, Cleaned up Google Drive Launch

This commit is contained in:
bschaper 2024-12-17 13:25:53 -06:00
parent b55fcfc8ee
commit d173966f96
3 changed files with 32 additions and 11 deletions

View File

@ -0,0 +1,24 @@
# Launch Google Drive for Desktop
$logFile = "%TEMP%\googledrive-launch.log"
# Check if Google Drive File Stream is already set to launch on startup
$startupKey = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
$driveKey = "GoogleDriveFS"
try {
$existingValue = Get-ItemProperty -Path $startupKey -Name $driveKey -ErrorAction Stop
Add-Content -Path $logFile -Value "Google Drive File Stream is already set to launch on startup."
}
catch {
# Key doesn't exist, so launch Google Drive
Add-Content -Path $logFile -Value "Launching Google Drive for Desktop..."
# Path to Google Drive launch executable
$driveLaunchPath = "C:\Program Files\Google\Drive File Stream\launch.bat"
# Start Google Drive
Start-Process -FilePath $driveLaunchPath -WindowStyle Hidden
# Wait for Google Drive to launch
Start-Sleep -Seconds 5
}

View File

@ -93,6 +93,12 @@ Powercfg /x -standby-timeout-ac 60
:: Set PowerOptions so the monitor will go off after 15 minutes :: Set PowerOptions so the monitor will go off after 15 minutes
powercfg -change -monitor-timeout-ac 15 powercfg -change -monitor-timeout-ac 15
:: Remove Leftovers
powershell Remove-Item -Path 'C:\Scripts\Software\Office2016'
powershell Remove-Item -Path 'C:\Scripts\Software\RemoteAgent64-TCSE.exe'
powershell Remove-Item -Path 'C:\Scripts\Software\gcpwstandaloneenterprise64.exe'
powershell Remove-Item -Path 'C:\Scripts\Autounattend'
:: Restart System :: Restart System
echo Restarting system in 2.5 minutes... echo Restarting system in 2.5 minutes...
timeout /t 150 timeout /t 150

View File

@ -42,17 +42,8 @@ echo Remove Edge Desktop Shortcut... >> "%LOGFILE%"
powershell -ExecutionPolicy Bypass -File "C:\Scripts\Login\Remove-EdgeShortcut.ps1" powershell -ExecutionPolicy Bypass -File "C:\Scripts\Login\Remove-EdgeShortcut.ps1"
:: Launch Google Drive for Desktop :: Launch Google Drive for Desktop
:: Check if Google Drive File Stream is already set to launch on startup echo Launching Google Drive... >> "%LOGFILE%"
reg query "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "GoogleDriveFS" >nul 2>&1 powershell -ExecutionPolicy Bypass -File "C:\Scripts\Login\Launch-GoogleDrive.ps1"
if %errorlevel% equ 0 (
echo Google Drive File Stream is already set to launch on startup. >> "%LOGFILE%"
) else (
echo Launching Google Drive for Desktop... >> "%LOGFILE%"
start /B "" "C:\Program Files\Google\Drive File Stream\launch.bat"
:: Wait for Google Drive to launch
timeout /t 5 /nobreak > nul
)
:: Uninstall OneDrive :: Uninstall OneDrive
echo Uninstall OneDrive... >> "%LOGFILE%" echo Uninstall OneDrive... >> "%LOGFILE%"