diff --git a/Login/Launch-GoogleDrive.ps1 b/Login/Launch-GoogleDrive.ps1 new file mode 100644 index 0000000..a473094 --- /dev/null +++ b/Login/Launch-GoogleDrive.ps1 @@ -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 +} \ No newline at end of file diff --git a/TCSE-Computer-Deploy.bat b/TCSE-Computer-Deploy.bat index 07be561..57ad256 100644 --- a/TCSE-Computer-Deploy.bat +++ b/TCSE-Computer-Deploy.bat @@ -93,6 +93,12 @@ Powercfg /x -standby-timeout-ac 60 :: Set PowerOptions so the monitor will go off after 15 minutes 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 echo Restarting system in 2.5 minutes... timeout /t 150 diff --git a/TCSE-Login.bat b/TCSE-Login.bat index 0775a8c..c937faf 100644 --- a/TCSE-Login.bat +++ b/TCSE-Login.bat @@ -42,17 +42,8 @@ echo Remove Edge Desktop Shortcut... >> "%LOGFILE%" powershell -ExecutionPolicy Bypass -File "C:\Scripts\Login\Remove-EdgeShortcut.ps1" :: Launch Google Drive for Desktop -:: Check if Google Drive File Stream is already set to launch on startup -reg query "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "GoogleDriveFS" >nul 2>&1 -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 -) +echo Launching Google Drive... >> "%LOGFILE%" +powershell -ExecutionPolicy Bypass -File "C:\Scripts\Login\Launch-GoogleDrive.ps1" :: Uninstall OneDrive echo Uninstall OneDrive... >> "%LOGFILE%"