diff --git a/Autounattend/Desktop/autounattend.xml b/Autounattend/Desktop/autounattend.xml index e9e901c..e5e9d4f 100644 --- a/Autounattend/Desktop/autounattend.xml +++ b/Autounattend/Desktop/autounattend.xml @@ -1,6 +1,6 @@ - + @@ -23,7 +23,7 @@ - 8PTT6-RNW4C-6V7J2-C2D3X-MHBPB + VK7JG-NPHTM-C97JM-9MPGT-3V66T true @@ -62,6 +62,10 @@ + + TEMPNAME + Central Standard Time + @@ -86,9 +90,6 @@ - - Central Standard Time - @@ -159,6 +160,41 @@ foreach( $file in $Document.unattend.Extensions.File ) { } } + +return Read-Host -Prompt 'Enter computer name'; + + +$ErrorActionPreference = 'Stop'; +Set-StrictMode -Version 'Latest'; +& { + $newName = ( Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\ComputerName.txt' -Raw ).Trim(); + if( [string]::IsNullOrWhitespace( $newName ) ) { + throw "No computer name was provided."; + } + + $keys = @( + @{ + LiteralPath = 'Registry::HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName'; + Name = 'ComputerName'; + }; + @{ + LiteralPath = 'Registry::HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters'; + Name = 'Hostname'; + }; + @{ + LiteralPath = 'Registry::HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters'; + Name = 'NV Hostname'; + }; + ); + + while( $true ) { + foreach( $key in $keys ) { + Set-ItemProperty @key -Type 'String' -Value $newName; + } + Start-Sleep -Milliseconds 50; + } +} *>&1 >> 'C:\Windows\Setup\Scripts\SetComputerName.log'; + $selectors = @( 'Microsoft.Microsoft3DViewer'; @@ -182,10 +218,12 @@ $selectors = @( 'Microsoft.OutlookForWindows'; 'Microsoft.MSPaint'; 'Microsoft.People'; + 'Microsoft.Windows.Photos'; 'Microsoft.PowerAutomateDesktop'; 'MicrosoftCorporationII.QuickAssist'; 'Microsoft.SkypeApp'; 'Microsoft.MicrosoftSolitaireCollection'; + 'Microsoft.MicrosoftStickyNotes'; 'MicrosoftTeams'; 'MSTeams'; 'Microsoft.Todos'; @@ -491,6 +529,11 @@ C:\Scripts\TCSE-Computer-Deploy.bat $scripts = @( + { + Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\GetComputerName.ps1' -Raw | Invoke-Expression > 'C:\Windows\Setup\Scripts\ComputerName.txt'; + Start-Process -FilePath ( Get-Process -Id $PID ).Path -ArgumentList '-NoProfile', '-Command', 'Get-Content -LiteralPath "C:\Windows\Setup\Scripts\SetComputerName.ps1" -Raw | Invoke-Expression;' -WindowStyle 'Hidden'; + Start-Sleep -Seconds 10; + }; { reg.exe add "HKLM\SYSTEM\Setup\MoSetup" /v AllowUpgradesWithUnsupportedTPMOrCPU /t REG_DWORD /d 1 /f; }; diff --git a/Autounattend/Laptop/autounattend.xml b/Autounattend/Laptop/autounattend.xml index 3cc0286..6c1756b 100644 --- a/Autounattend/Laptop/autounattend.xml +++ b/Autounattend/Laptop/autounattend.xml @@ -1,6 +1,6 @@ - + @@ -23,7 +23,7 @@ - 8PTT6-RNW4C-6V7J2-C2D3X-MHBPB + VK7JG-NPHTM-C97JM-9MPGT-3V66T true @@ -62,6 +62,10 @@ + + TEMPNAME + Central Standard Time + @@ -86,9 +90,6 @@ - - Central Standard Time - @@ -158,6 +159,41 @@ foreach( $file in $Document.unattend.Extensions.File ) { } } + +return Read-Host -Prompt 'Enter computer name'; + + +$ErrorActionPreference = 'Stop'; +Set-StrictMode -Version 'Latest'; +& { + $newName = ( Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\ComputerName.txt' -Raw ).Trim(); + if( [string]::IsNullOrWhitespace( $newName ) ) { + throw "No computer name was provided."; + } + + $keys = @( + @{ + LiteralPath = 'Registry::HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName'; + Name = 'ComputerName'; + }; + @{ + LiteralPath = 'Registry::HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters'; + Name = 'Hostname'; + }; + @{ + LiteralPath = 'Registry::HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters'; + Name = 'NV Hostname'; + }; + ); + + while( $true ) { + foreach( $key in $keys ) { + Set-ItemProperty @key -Type 'String' -Value $newName; + } + Start-Sleep -Milliseconds 50; + } +} *>&1 >> 'C:\Windows\Setup\Scripts\SetComputerName.log'; + $selectors = @( 'Microsoft.Microsoft3DViewer'; @@ -181,10 +217,12 @@ $selectors = @( 'Microsoft.OutlookForWindows'; 'Microsoft.MSPaint'; 'Microsoft.People'; + 'Microsoft.Windows.Photos'; 'Microsoft.PowerAutomateDesktop'; 'MicrosoftCorporationII.QuickAssist'; 'Microsoft.SkypeApp'; 'Microsoft.MicrosoftSolitaireCollection'; + 'Microsoft.MicrosoftStickyNotes'; 'MicrosoftTeams'; 'MSTeams'; 'Microsoft.Todos'; @@ -517,6 +555,11 @@ C:\Scripts\TCSE-Computer-Deploy.bat $scripts = @( + { + Get-Content -LiteralPath 'C:\Windows\Setup\Scripts\GetComputerName.ps1' -Raw | Invoke-Expression > 'C:\Windows\Setup\Scripts\ComputerName.txt'; + Start-Process -FilePath ( Get-Process -Id $PID ).Path -ArgumentList '-NoProfile', '-Command', 'Get-Content -LiteralPath "C:\Windows\Setup\Scripts\SetComputerName.ps1" -Raw | Invoke-Expression;' -WindowStyle 'Hidden'; + Start-Sleep -Seconds 10; + }; { reg.exe add "HKLM\SYSTEM\Setup\MoSetup" /v AllowUpgradesWithUnsupportedTPMOrCPU /t REG_DWORD /d 1 /f; }; diff --git a/GCPW/First-Boot-Force-Restart.ps1 b/GCPW/First-Boot-Force-Restart.ps1 deleted file mode 100644 index 3a489bb..0000000 --- a/GCPW/First-Boot-Force-Restart.ps1 +++ /dev/null @@ -1,2 +0,0 @@ -Start-Sleep -Seconds 1 # Adjust the delay as needed -Restart-Computer -Force \ No newline at end of file diff --git a/GCPW/First-Boot-Restart-Task.ps1 b/GCPW/First-Boot-Restart-Task.ps1 deleted file mode 100644 index 372a051..0000000 --- a/GCPW/First-Boot-Restart-Task.ps1 +++ /dev/null @@ -1,6 +0,0 @@ -# Create a Scheduled Task to Run at System Startup -$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-ExecutionPolicy Bypass -File C:\Scripts\GCPW\First-Boot-Force-Restart.ps1" - -$trigger = New-ScheduledTaskTrigger -AtStartup - -Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "ForceRestartAfterNextBoot" -RunLevel Highest \ No newline at end of file diff --git a/GCPW/Run-Google-Updater.ps1 b/GCPW/Run-Google-Updater.ps1 deleted file mode 100644 index bbaaaf5..0000000 --- a/GCPW/Run-Google-Updater.ps1 +++ /dev/null @@ -1,25 +0,0 @@ -# Get the Google Update folder path -$googleUpdateFolder = "C:\Program Files (x86)\Google\GoogleUpdater" - -# Get all subfolders and extract version numbers -$subfolders = Get-ChildItem $googleUpdateFolder | Where-Object { $_.PSIsContainer -and $_.BaseName -match '\d+\.\d+\.\d+\.\d+' } | ForEach-Object { - [version]$_.BaseName -} - -# Find the subfolder with the highest version number -$latestSubfolder = $subfolders | Sort-Object -Descending | Select-Object -First 1 - -if ($latestSubfolder) { - # Construct the full path to the updater.exe, ensuring proper quoting - $updaterPath = Join-Path $googleUpdateFolder $latestSubfolder - $updaterPath += "\updater.exe" - $quotedUpdaterPath = '"' + $updaterPath + '"' - - # Create a new task with the updated path and a startup trigger - $newTaskName = "Update_Chrome_" + (Get-Date -Format "yyyyMMddHHmmss") - Register-ScheduledTask -TaskName $newTaskName -Action (New-ScheduledTaskAction -Execute $quotedUpdaterPath -Argument "--wake --system") -Trigger (New-JobTrigger -AtStartup) -Principal (New-ScheduledTaskPrincipal -UserId "SYSTEM" -RunLevel Highest) - - Write-Host "New task '$newTaskName' created with startup trigger and updated path: $quotedUpdaterPath" -} else { - Write-Host "Google Update folder or updater.exe not found." -} \ No newline at end of file diff --git a/GCPW/GCPW-AllowDomains.ps1 b/Patches/GCPW/GCPW-AllowDomains.ps1 similarity index 100% rename from GCPW/GCPW-AllowDomains.ps1 rename to Patches/GCPW/GCPW-AllowDomains.ps1 diff --git a/GroupPolicy/LGPO.exe b/Patches/GroupPolicy/LGPO.exe similarity index 100% rename from GroupPolicy/LGPO.exe rename to Patches/GroupPolicy/LGPO.exe diff --git a/GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/Backup.xml b/Patches/GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/Backup.xml similarity index 100% rename from GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/Backup.xml rename to Patches/GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/Backup.xml diff --git a/GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/Bkupinfo.xml b/Patches/GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/Bkupinfo.xml similarity index 100% rename from GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/Bkupinfo.xml rename to Patches/GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/Bkupinfo.xml diff --git a/GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/DomainSysvol/GPO/Machine/microsoft/windows nt/Audit/audit.csv b/Patches/GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/DomainSysvol/GPO/Machine/microsoft/windows nt/Audit/audit.csv similarity index 100% rename from GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/DomainSysvol/GPO/Machine/microsoft/windows nt/Audit/audit.csv rename to Patches/GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/DomainSysvol/GPO/Machine/microsoft/windows nt/Audit/audit.csv diff --git a/GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/DomainSysvol/GPO/Machine/microsoft/windows nt/SecEdit/GptTmpl.inf b/Patches/GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/DomainSysvol/GPO/Machine/microsoft/windows nt/SecEdit/GptTmpl.inf similarity index 100% rename from GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/DomainSysvol/GPO/Machine/microsoft/windows nt/SecEdit/GptTmpl.inf rename to Patches/GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/DomainSysvol/GPO/Machine/microsoft/windows nt/SecEdit/GptTmpl.inf diff --git a/GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/DomainSysvol/GPO/Machine/registry.pol b/Patches/GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/DomainSysvol/GPO/Machine/registry.pol similarity index 100% rename from GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/DomainSysvol/GPO/Machine/registry.pol rename to Patches/GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/DomainSysvol/GPO/Machine/registry.pol diff --git a/GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/DomainSysvol/GPO/User/registry.pol b/Patches/GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/DomainSysvol/GPO/User/registry.pol similarity index 100% rename from GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/DomainSysvol/GPO/User/registry.pol rename to Patches/GroupPolicy/{33C2D9E4-D084-4EE4-99D0-BC6DF203B32D}/DomainSysvol/GPO/User/registry.pol diff --git a/Software/Desktop-Rename.ps1 b/Software/Desktop-Rename.ps1 deleted file mode 100644 index cbf59f5..0000000 --- a/Software/Desktop-Rename.ps1 +++ /dev/null @@ -1,29 +0,0 @@ -# Prompt the user for device type -$deviceType = Read-Host "Is the device a Desktop (1) or Laptop (2)?" - -# Validate the device type input -while ($deviceType -notin 1, 2) { - Write-Warning "Invalid input. Please enter 1 for Desktop or 2 for Laptop." - $deviceType = Read-Host "Is the device a Desktop (1) or Laptop (2)?" -} - -# Prompt the user for the device ID -$deviceId = Read-Host "Enter the device ID number:" - -# Construct the new computer name based on device type and ID -$newComputerName = if ($deviceType -eq 1) { - "DESKTOP-$deviceId" -} else { - "LAPTOP-$deviceId" -} - -# Check if the computer with the new name already exists using WMI -$existingComputer = Get-WmiObject -Class Win32_ComputerSystem -Filter "Name='$newComputerName'" - -if ($existingComputer) { - Write-Warning "A computer with the name '$newComputerName' already exists. Please choose a different ID." -} else { - # Rename the computer - Rename-Computer -NewName $newComputerName -Force - Write-Host "Computer renamed successfully to: $newComputerName" -} \ No newline at end of file diff --git a/TCSE-Computer-Deploy.bat b/TCSE-Computer-Deploy.bat index 713ac41..fcfe571 100644 --- a/TCSE-Computer-Deploy.bat +++ b/TCSE-Computer-Deploy.bat @@ -11,7 +11,6 @@ powershell -ExecutionPolicy Bypass -File "C:\Scripts\Printers\01-Printer-Scripts :: Install Google Chrome Enterprise & Accept Winget Terms echo Installing Google Chrome... -:: C:\Users\Tech\AppData\Local\Microsoft\WindowsApps\winget.exe install Google.Chrome -h -s winget winget install --exact --id Google.Chrome --silent --accept-source-agreements --accept-package-agreements :: Install Google Cloud Provider for Windows @@ -26,22 +25,22 @@ echo TCSE Remote MeshCentral Installed... :: Install Google Drive echo Installing Google Drive... -:: C:\Users\Tech\AppData\Local\Microsoft\WindowsApps\winget.exe install Google.GoogleDrive -h -s winget winget install --exact --id Google.GoogleDrive --silent :: Install VLC Media Player echo Installing VLC Media Player... -:: C:\Users\Tech\AppData\Local\Microsoft\WindowsApps\winget.exe install VideoLAN.VLC -h -s winget winget install --exact --id VideoLAN.VLC --silent +:: Install ImageGlass Image Viewer +echo Installing ImageGlass... +winget install --exact --id DuongDieuPhap.ImageGlass --silent + :: Install Zoom echo Installing Zoom... -:: C:\Users\Tech\AppData\Local\Microsoft\WindowsApps\winget.exe install Zoom.Zoom -h -s winget winget install --exact --id Zoom.Zoom --silent :: Install Adobe Reader echo Installing Adobe Reader... -:: C:\Users\Tech\AppData\Local\Microsoft\WindowsApps\winget.exe install Adobe.Acrobat.Reader.64-bit -h -s winget winget install --exact --id Adobe.Acrobat.Reader.64-bit --silent :: Run Debloat Script @@ -81,37 +80,21 @@ for %%F in ("%PUBLIC_DESKTOP%\*.lnk") do ( :: Display results echo Deleted !deleted_count! shortcut(s) from the Public Desktop. -:: Install Google Cloud Provider for Windows - Second Time -:: echo Installing Google Cloud Provider for Windows Second Time... -:: C:\Scripts\Software\gcpwstandaloneenterprise64.exe /silent /fullinstall -:: echo Google Cloud Provider for Windows Installed Second Time... - -:: Add Scheduled Tasks to Force GCPW Update -:: echo Run Google Updater... -:: powershell -ExecutionPolicy Bypass -File "C:\Scripts\GCPW\Run-Google-Updater.ps1" -:: echo Run Create First Boot Restart Task... -:: powershell -ExecutionPolicy Bypass -File "C:\Scripts\GCPW\First-Boot-Restart-Task.ps1" - -:: Install Google Cloud Provider for Windows - Third Time -:: echo Installing Google Cloud Provider for Windows Second Time... -:: C:\Scripts\Software\gcpwstandaloneenterprise64.exe /silent /fullinstall -:: echo Google Cloud Provider for Windows Installed Third Time... - :: GCPW Add Allowed Domain to Registry echo Adding Domain to GCPW Registry... -powershell -ExecutionPolicy Bypass -File "C:\Scripts\GCPW\GCPW-AllowDomains.ps1" +powershell -ExecutionPolicy Bypass -File "C:\Scripts\Patches\GCPW\GCPW-AllowDomains.ps1" echo Allowed Domain Added to Registry... +:: Apply Local Group Policy +echo Adding Group Policy to All Users... +C:\Scripts\Patches\GroupPolicy\LGPO.exe /g C:\Scripts\Patches\GroupPolicy\ +echo Successfully Applied Policy... + :: 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' echo Successfully Copied Login Scripts... -:: Apply Local Group Policy -echo Adding Group Policy to All Users... -C:\Scripts\GroupPolicy\LGPO.exe /g C:\Scripts\GroupPolicy\ -echo Successfully Applied Policy... - :: Restart System echo Restarting system in 2.5 minutes... timeout /t 150