Remove Files After Install, Cleaned up Google Drive Launch
This commit is contained in:
parent
b55fcfc8ee
commit
d173966f96
24
Login/Launch-GoogleDrive.ps1
Normal file
24
Login/Launch-GoogleDrive.ps1
Normal 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
|
||||||
|
}
|
||||||
@ -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
|
||||||
|
|||||||
@ -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%"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user