From 2d84c850f75e355f408cd3cd0f54c4e36f584eb7 Mon Sep 17 00:00:00 2001 From: bschaper Date: Mon, 9 Dec 2024 21:16:35 -0600 Subject: [PATCH] Partial Initial Upload --- .gitignore | 1 + Login/Disable-EdgeStartup.ps1 | 28 ++++++++ Login/Disable-OneDriveStartup.ps1 | 28 ++++++++ Login/Remove-EdgeShortcut.ps1 | 35 ++++++++++ Login/Uninstall-OneDrive.bat | 23 +++++++ StartLayouts/TCSE-Layout-Import-Admin.reg | Bin 0 -> 854 bytes StartLayouts/TCSE-Layout-Import-User.reg | Bin 0 -> 944 bytes StartLayouts/TCSE-Layout.xml | 19 +++++ TCSE-Computer-Deploy.bat | 80 ++++++++++++++++++++++ TCSE-Login.bat | 53 ++++++++++++++ TCSE-Login.vbs | 4 ++ 11 files changed, 271 insertions(+) create mode 100644 .gitignore create mode 100644 Login/Disable-EdgeStartup.ps1 create mode 100644 Login/Disable-OneDriveStartup.ps1 create mode 100644 Login/Remove-EdgeShortcut.ps1 create mode 100755 Login/Uninstall-OneDrive.bat create mode 100644 StartLayouts/TCSE-Layout-Import-Admin.reg create mode 100644 StartLayouts/TCSE-Layout-Import-User.reg create mode 100644 StartLayouts/TCSE-Layout.xml create mode 100644 TCSE-Computer-Deploy.bat create mode 100644 TCSE-Login.bat create mode 100644 TCSE-Login.vbs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/Login/Disable-EdgeStartup.ps1 b/Login/Disable-EdgeStartup.ps1 new file mode 100644 index 0000000..8dc74b8 --- /dev/null +++ b/Login/Disable-EdgeStartup.ps1 @@ -0,0 +1,28 @@ +# Get the registry key where startup programs are stored +$registryKey = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" + +# Get all registry values (not child items) from the Run key +$edgeEntries = Get-ItemProperty -Path $registryKey | + Get-Member -MemberType NoteProperty | + Where-Object { $_.Name -like "MicrosoftEdgeAutoLaunch_*" } + +# Check if any Edge entries were found +if ($edgeEntries) { + foreach ($edgeEntry in $edgeEntries) { + try { + # Remove the registry value + Remove-ItemProperty -Path $registryKey -Name $edgeEntry.Name + # Verify removal + $checkRemoval = Get-ItemProperty -Path $registryKey -Name $edgeEntry.Name -ErrorAction SilentlyContinue + if ($null -eq $checkRemoval) { + Write-Host "Microsoft Edge startup entry removed: $($edgeEntry.Name)" + } else { + Write-Warning "Failed to remove Microsoft Edge startup entry: $($edgeEntry.Name)" + } + } catch { + Write-Warning "Error removing Microsoft Edge startup entry: $($_.Exception.Message)" + } + } +} else { + Write-Warning "No Microsoft Edge startup entries found. Please manually verify the registry key." +} \ No newline at end of file diff --git a/Login/Disable-OneDriveStartup.ps1 b/Login/Disable-OneDriveStartup.ps1 new file mode 100644 index 0000000..824dae4 --- /dev/null +++ b/Login/Disable-OneDriveStartup.ps1 @@ -0,0 +1,28 @@ +# Get the registry key where startup programs are stored +$registryKey = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" + +# Get all registry values (not child items) from the Run key +$driveEntries = Get-ItemProperty -Path $registryKey | + Get-Member -MemberType NoteProperty | + Where-Object { $_.Name -like "OneDriveSetup" -or $_.Name -like "OneDrive" } + +# Check if any OneDrive entries were found +if ($driveEntries) { + foreach ($driveEntry in $driveEntries) { + try { + # Remove the registry value + Remove-ItemProperty -Path $registryKey -Name $driveEntry.Name + # Verify removal + $checkRemoval = Get-ItemProperty -Path $registryKey -Name $driveEntry.Name -ErrorAction SilentlyContinue + if ($null -eq $checkRemoval) { + Write-Host "OneDrive startup entry removed: $($driveEntry.Name)" + } else { + Write-Warning "Failed to remove OneDrive startup entry: $($driveEntry.Name)" + } + } catch { + Write-Warning "Error removing OneDrive startup entry: $($_.Exception.Message)" + } + } +} else { + Write-Warning "No OneDrive startup entries found. Please manually verify the registry key." +} \ No newline at end of file diff --git a/Login/Remove-EdgeShortcut.ps1 b/Login/Remove-EdgeShortcut.ps1 new file mode 100644 index 0000000..4f8a015 --- /dev/null +++ b/Login/Remove-EdgeShortcut.ps1 @@ -0,0 +1,35 @@ +# Script to remove Microsoft Edge desktop shortcut if it exists +# Get the currently logged in username +$currentUser = [System.Environment]::UserName + +# Define the path to the current user's desktop +$desktopPath = "C:\Users\$currentUser\Desktop" + +# Define the possible Edge shortcut names +$edgeShortcuts = @( + "Microsoft Edge.lnk", + "Microsoft Edge (Beta).lnk", + "Microsoft Edge (Dev).lnk", + "Microsoft Edge (Canary).lnk" +) + +# Loop through potential shortcut names +foreach ($shortcut in $edgeShortcuts) { + $fullPath = Join-Path -Path $desktopPath -ChildPath $shortcut + + # Check if the shortcut exists + if (Test-Path $fullPath) { + try { + # Remove the shortcut + Remove-Item $fullPath -Force + Write-Host "Deleted shortcut: $shortcut from $currentUser's desktop" + } + catch { + Write-Host "Error deleting shortcut $shortcut : $_" + } + } + else { + Write-Host "Shortcut $shortcut not found on $currentUser's desktop" + } +} +Write-Host "Edge shortcut removal process completed for user $currentUser." \ No newline at end of file diff --git a/Login/Uninstall-OneDrive.bat b/Login/Uninstall-OneDrive.bat new file mode 100755 index 0000000..fec92b6 --- /dev/null +++ b/Login/Uninstall-OneDrive.bat @@ -0,0 +1,23 @@ +@echo off +:: Check if OneDrive is installed +echo Checking if Microsoft OneDrive is installed... + +:: Check for OneDrive installation by looking for its executable +if exist "%LOCALAPPDATA%\Microsoft\OneDrive\OneDrive.exe" ( + echo OneDrive is installed. Proceeding with uninstallation... + + echo Uninstalling OneDrive... >> "%LOGFILE%" + if exist "%SystemRoot%\System32\OneDriveSetup.exe" ( + "%SystemRoot%\System32\OneDriveSetup.exe" /uninstall + if !errorlevel! neq 0 ( + echo ERROR: Failed to uninstall OneDrive + ) else ( + echo Successfully uninstalled OneDrive + ) + ) else ( + echo WARNING: OneDriveSetup.exe not found + ) +) else ( + echo WARNING: Microsoft OneDrive is not installed. Skipping uninstallation. +) +endlocal \ No newline at end of file diff --git a/StartLayouts/TCSE-Layout-Import-Admin.reg b/StartLayouts/TCSE-Layout-Import-Admin.reg new file mode 100644 index 0000000000000000000000000000000000000000..9be068f457d3b450cf809c741d4bdc2df79a38be GIT binary patch literal 854 zcmbu8-Acni5QWdR;5(FFDFm^#O;qqgibe64Di$$Pim6&GjkJ~4msh{ty2%LYjfBn4 zoS8XuW;gkG?`o*AGUb|Us){-q=n-tHnI?JzIUqX3%ke9^CO#oL#2@1~wV_R(Rjv4S zt3w@AbEBS4bgq{6*?T%=ZxK7v8PQai#M-)27rf(<3m8Z6-m?aDNU3q&1boVRKtoEt z)tgee&oqG$N{-d(g aXXmbSpMgEmc45b+Yi!PDIh%Wjf8Y~UQfur0 literal 0 HcmV?d00001 diff --git a/StartLayouts/TCSE-Layout-Import-User.reg b/StartLayouts/TCSE-Layout-Import-User.reg new file mode 100644 index 0000000000000000000000000000000000000000..a8b38e5d88f7db63b5ced0360b40cf48fd8e3cab GIT binary patch literal 944 zcmbu8UrPc(6vfYT(034@3MA6j-3of?A3+vjSwtIQx~UWz?uz>5tKW>y?g$k@EW2~> zx%ZxX?#%4x$DIZms;iNvN>x%*iF#nEGL1C{IUzd08{wC9OMFapfIq~qYfIZa>sqt# zgU)nL&Apy2|Ol=DHGqHqjiS5%-Ux(z*KqgGtvz;<>%`B zJk=$4gLp@;)OO*?EOVv?>zv30 z>t0Ui*%2HrC)8eUNANj3qJy(zJ8OyajXaj0I{B5MsyU0_)z1k$#jE*+vXJ}X)I{8} z!Zs=kedcT`zo;x`^7qf*r@&*cai*@*e^eIw{JCqKr(=(_o7 + + + + + + + + + + + + + \ No newline at end of file diff --git a/TCSE-Computer-Deploy.bat b/TCSE-Computer-Deploy.bat new file mode 100644 index 0000000..ff15b57 --- /dev/null +++ b/TCSE-Computer-Deploy.bat @@ -0,0 +1,80 @@ +@echo off + +:: Install Winget Package Manager +C:\Scripts\Software\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle + +:: Install Chocolatey Package Manager +timeout /t 30 +echo Installing Chocolatey... +C:\Users\Tech\AppData\Local\Microsoft\WindowsApps\winget.exe install --id chocolatey.chocolatey --source winget + +:: Install Chocolatey Software +echo Installing Chocolatey Software... +C:\ProgramData\Chocolatey\choco.exe upgrade adobereader -y --ignore-checksums +C:\ProgramData\Chocolatey\choco.exe install googlechrome -y --ignore-checksums +C:\ProgramData\Chocolatey\choco.exe install google-drive-file-stream -y --ignore-checksums + +:: Install Printers +powershell -ExecutionPolicy Bypass -File "C:\Scripts\Printers\01-Printer-Scripts\01-PrinterInstall-AllPrinters.ps1" +powershell -ExecutionPolicy Bypass -File "C:\Scripts\Printers\01-Printer-Scripts\02.2-PrinterProperties-Import.ps1" + +:: Set Time Zone +tzutil /s "Central Standard Time" + +:: Install Additional Software +echo Installing Additional Software... +echo Installing GCPW... +C:\Scripts\Software\gcpwstandaloneenterprise64.exe /silent /fullinstall +echo GCPW Installed... +echo Installing MeshCentral... +C:\Scripts\Software\RemoteAgent64-TCSE.exe -fullinstall +echo MeshCentral Installed... +echo Installing Office 2016... +C:\Scripts\Software\Office2016\setup.exe /adminfile C:\Scripts\Software\Office2016\TCSE.MSP +echo Office 2016 Installed... + +:: Run Debloat Script +powershell -ExecutionPolicy Bypass -File "C:\Scripts\Software\Win11Debloat\Win11Debloat.ps1" -Silent -Sysprep -RemoveApps -RemoveCommApps -RemoveW11Outlook -RemoveDevApps -RemoveGamingApps -DisableDVR -ClearStartAllUsers -DisableTelemetry -DisableBing -DisableSuggestions -DisableLockscreenTips -ShowKnownFileExt -TaskbarAlignLeft -ShowSearchIconTb -HideTaskview -HideChat -DisableWidgets -DisableCopilot -DisableRecall + +::: Define Taskbar Layout Path +set "REG_FILES_DIR=C:\Scripts\StartLayouts" + +::: Loop through each .reg file in the directory +for %%f in (%REG_FILES_DIR%\*.reg) do ( + reg import "%%f" +) + +echo Taskbar layout successfully imported... + +:: Remove All Shortcuts from Public Desktop Folder +:: Set the path to the Public Desktop folder +set "PUBLIC_DESKTOP=%PUBLIC%\Desktop" + +:: Counter for deleted shortcuts +set "deleted_count=0" + +:: Check if the Public Desktop folder exists +if not exist "%PUBLIC_DESKTOP%" ( + echo Error: Public Desktop folder not found. + exit /b 1 +) + +:: Remove all .lnk files from the Public Desktop +for %%F in ("%PUBLIC_DESKTOP%\*.lnk") do ( + del "%%F" + if !errorlevel! equ 0 ( + set /a "deleted_count+=1" + ) +) + +:: Display results +echo Deleted !deleted_count! shortcut(s) from the Public Desktop. + +:: Copy Login Scripts to User Startup +echo Copying Login Scripts to All Users... +powershell Copy-Item 'C:\Scripts\TCSE-Login.vbs' 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup' + +:: Restart System +echo Restarting system in 5 minutes... +timeout /t 300 +shutdown /r /t 0 \ No newline at end of file diff --git a/TCSE-Login.bat b/TCSE-Login.bat new file mode 100644 index 0000000..ee01a92 --- /dev/null +++ b/TCSE-Login.bat @@ -0,0 +1,53 @@ +@echo off +setlocal EnableDelayedExpansion + +:: Script to configure default file associations, remove OneDrive, disable Edge, and launch Google Drive +:: Created: 2024-11-21 + +:: Set up logging +set "LOGFILE=%TEMP%\tcse-login-script.log" +set "LOGFILE=%LOGFILE: =0%" + +echo Starting setup script at %DATE% %TIME% > "%LOGFILE%" + +:: Set App Defaults +echo Setting Default Apps... >> "%LOGFILE%" +C:\Scripts\Software\setuserfta.exe .pdf AcroExch.Document +C:\Scripts\Software\setuserfta.exe .htm ChromeHTML +C:\Scripts\Software\setuserfta.exe .html ChromeHTML +C:\Scripts\Software\setuserfta.exe http ChromeHTML +C:\Scripts\Software\setuserfta.exe https ChromeHTML + +:: Disable OneDrive Startup +echo Disable OneDrive Startup... >> "%LOGFILE%" +powershell -ExecutionPolicy Bypass -File "C:\Scripts\Login\Disable-OneDriveStartup.ps1" + +:: Disable Edge Startup +echo Disable Edge Startup... >> "%LOGFILE%" +powershell -ExecutionPolicy Bypass -File "C:\Scripts\Login\Disable-EdgeStartup.ps1" + +:: Remove Edge Desktop Shortcut +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 +) + +:: Uninstall OneDrive +echo Uninstall OneDrive... >> "%LOGFILE%" +"C:\Scripts\Login\Uninstall-OneDrive.bat" + +echo Script completed at %DATE% %TIME% >> "%LOGFILE%" +echo Log file created at: %LOGFILE% + +endlocal \ No newline at end of file diff --git a/TCSE-Login.vbs b/TCSE-Login.vbs new file mode 100644 index 0000000..44e12dd --- /dev/null +++ b/TCSE-Login.vbs @@ -0,0 +1,4 @@ +Dim WshShell +Set WshShell = CreateObject("Wscript.Shell") +WshShell.Run "cmd /c C:\Scripts\TCSE-Login.bat", 0, False +Set WshShell = Nothing \ No newline at end of file