############ Download Programs ################### Write-Output "Downloading setup Programs..." $downloadUrlPrefix = "https://cowetacomputers.com/downloads/" $downloadsDir = "C:\NPCDownloads" # Create the downloads directory if it doesn't exist if (-not (Test-Path $downloadsDir)) { New-Item -ItemType Directory -Path $downloadsDir | Out-Null } #Logging + transcript $LogDir = "C:\NPCDownloads\Logs" New-Item $LogDir -ItemType Directory -Force | Out-Null Start-Transcript -Path (Join-Path $LogDir ("Setup-{0:yyyyMMdd-HHmmss}.log" -f (Get-Date))) -Force $ErrorActionPreference = "SilentlyContinue" # Create WebClient for downloading files $webClient = New-Object System.Net.WebClient $webClient.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36") # Download files $webClient.DownloadFile("https://git.cowetacomputers.com/api/v1/repos/Coweta-Computers/utilities/+/raw/setup-script.ps1?routingId=&git_ref=main", (Join-Path $downloadsDir "setup-script.ps1")) $webClient.DownloadFile("https://git.cowetacomputers.com/api/v1/repos/Coweta-Computers/utilities/+/raw/new-setup.bat?routingId=&git_ref=main", (Join-Path $downloadsDir "new-setup.bat")) $webClient.DownloadFile("https://api.cowetacomputers.com/clients/4c38b5e3-e623-43db-8f98-40a839927ed6/deploy/", (Join-Path $downloadsDir "Tactical_rmm.exe")) # Download a PowerShell script $webClient.DownloadFile("https://git.cowetacomputers.com/api/v1/repos/Coweta-Computers/utilities/+/raw/SecondScript.ps1?routingId=&git_ref=main", (Join-Path $downloadsDir "SecondScript.ps1")) # Clean up the WebClient $webClient.Dispose() ############ Install Programs ################### Write-Output "Installing Programs......." # Run new-setup.bat Start-Process -FilePath (Join-Path $downloadsDir "new-setup.bat") -ArgumentList "/silent" -Verb RunAs -Wait # Install Tactical RMM Start-Process -FilePath (Join-Path $downloadsDir "Tactical_rmm.exe") -ArgumentList "-silent" -Verb RunAs -Wait # Install power scheme Write-Output "Installing Power Schemes..." powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61 powercfg -duplicatescheme 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c # Set power scheme as active and set sleep settings Write-Output "Setting Power Scheme and Timeouts..." powercfg.exe -SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c powercfg -change monitor-timeout-ac 0 powercfg -change disk-timeout-ac 0 powercfg -change standby-timeout-ac 0 powercfg -change monitor-timeout-dc 0 powercfg -change disk-timeout-dc 0 powercfg -change standby-timeout-dc 0 # Disable display and sleep mode timeouts Write-Output "Disabling display and sleep mode timeouts..." powercfg /X monitor-timeout-ac 0 powercfg /X monitor-timeout-dc 0 powercfg /X standby-timeout-ac 0 powercfg /X standby-timeout-dc 0 Write-Output "Configuring Power Button, Sleep Button, and Lid Close Actions..." # Get the currently active power scheme $powercfgOutput = powercfg /GETACTIVESCHEME $activeScheme = ($powercfgOutput -split ' ')[3] # Define GUIDs for various settings $subgroupGuid = '4f971e89-eebd-4455-a8de-9e59040e7347' $powerButtonActionGuid = '7648efa3-dd9c-4e3e-b566-50f929386280' $lidCloseActionGuid = '5ca83367-6e45-459f-a27b-476b1d01c936' $sleepButtonActionGuid = '96996bc0-ad50-47ec-923b-6f41874dd9eb' $doNothingIndex = '0' $shutdownIndex = '6' # Set Power Button Action to Shutdown Write-Output "Configuring Power Button Action..." try { powercfg /SETACVALUEINDEX $activeScheme $subgroupGuid $powerButtonActionGuid $shutdownIndex powercfg /SETDCVALUEINDEX $activeScheme $subgroupGuid $powerButtonActionGuid $shutdownIndex Write-Output "Power Button action set to Shutdown." } catch { Write-Output "Failed to set Power Button action." } # Set Lid Close Action to Do Nothing Write-Output "Configuring Lid Close Action..." try { powercfg /SETACVALUEINDEX $activeScheme $subgroupGuid $lidCloseActionGuid $doNothingIndex powercfg /SETDCVALUEINDEX $activeScheme $subgroupGuid $lidCloseActionGuid $doNothingIndex Write-Output "Lid Close action set to Do Nothing." } catch { Write-Output "Failed to set Lid Close action." } # Set Sleep Button Action to Do Nothing (if needed) Write-Output "Configuring Sleep Button Action..." try { powercfg /SETACVALUEINDEX $activeScheme $subgroupGuid $sleepButtonActionGuid $doNothingIndex powercfg /SETDCVALUEINDEX $activeScheme $subgroupGuid $sleepButtonActionGuid $doNothingIndex Write-Output "Sleep Button action set to Do Nothing." } catch { Write-Output "Failed to set Sleep Button action." } # Reactivate the power scheme to apply changes Write-Output "Reactivating Power Scheme..." try { powercfg /SetActive $activeScheme Write-Output "Power scheme activated." } catch { Write-Output "Failed to activate power scheme." } #Disable UAC Write-Output "Disabling UAC..." New-ItemProperty -Path HKLM:Software\Microsoft\Windows\CurrentVersion\policies\system -Name EnableLUA -PropertyType DWord -Value 0 -Force #Clear Bitlocker Write-Output "Clear Bitlocker and disable Bitlocker...." Clear-BitLockerAutoUnlock Disable-BitLocker -MountPoint "C:" # Disable News & Interest in Taskbar Write-Output "Disabling News & Interests..." Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Feeds -Name ShellFeedsTaskbarViewMode -Value 2 # Uninstall Unneeded Apps Write-Output "Uninstalling default apps..." $apps = @( # default Windows 10 apps "Microsoft.3DBuilder" "Microsoft.AppConnector" "Microsoft.BingFinance" "Microsoft.BingNews" "Microsoft.BingSports" "Microsoft.BingWeather" "Microsoft.CommsPhone" "Microsoft.ConnectivityStore" "Microsoft.DesktopAppInstaller" "Microsoft.GetHelp" "Microsoft.Getstarted" "Microsoft.Messaging" "Microsoft.Microsoft3DViewer" "Microsoft.MicrosoftOfficeHub" "Microsoft.MicrosoftStickyNotes" "Microsoft.MixedReality.Portal" "Microsoft.Office.OneNote" "Microsoft.Office.Sway" "Microsoft.OneConnect" "Microsoft.People" "Microsoft.SkypeApp" "Microsoft.Tips" "Microsoft.Wallet" "microsoft.windowscommunicationsapps" "Microsoft.WindowsDVDPlayer" "Microsoft.WindowsFeedbackHub" "Microsoft.WindowsMaps" "Microsoft.WindowsPhone" "Microsoft.WindowsSoundRecorder" "Microsoft.Xbox.TCUI" "Microsoft.XboxApp" "Microsoft.XboxGameOverlay" "Microsoft.XboxGamingOverlay" "Microsoft.XboxIdentityProvider" "Microsoft.XboxSpeechToTextOverlay" "Microsoft.YourPhone" "Microsoft.ZuneMusic" "Microsoft.ZuneVideo" # non-Microsoft "2FE3CB00.PicsArt-PhotoStudio" "46928bounde.EclipseManager" "4DF9E0F8.Netflix" "6Wunderkinder.Wunderlist" "89006A2E.AutodeskSketchBook" "9E2F88E3.Twitter" "A278AB0D.MarchofEmpires" "ActiproSoftwareLLC.562882FEEB491" "ClearChannelRadioDigital.iHeartRadio" "D52A8D61.FarmVille2CountryEscape" "D5EA27B7.Duolingo-LearnLanguagesforFree" "DB6EA5DB.CyberLinkMediaSuiteEssentials" "DolbyLaboratories.DolbyAccess" "Drawboard.DrawboardPDF" "Facebook.Facebook" "flaregamesGmbH.RoyalRevolt2" "Flipboard.Flipboard" "GAMELOFTSA.Asphalt8Airborne" "KeeperSecurityInc.Keeper" "king.com.*" "king.com.BubbleWitch3Saga" "king.com.CandyCrushSaga" "king.com.CandyCrushSodaSaga" "Microsoft.MinecraftUWP" "PandoraMediaInc.29680B314EFC2" "Playtika.CaesarsSlotsFreeCasino" "ShazamEntertainmentLtd.Shazam" "TheNewYorkTimes.NYTCrossword" "ThumbmunkeysLtd.PhototasticCollage" "TuneIn.TuneInRadio" "XINGAG.XING" # Wildcards "*DisneyMagicKingdoms*" "*HiddenCityMysteryofShadows*" "*MarchofEmpires*" # Win 2004 "Microsoft.549981C3F5F10" ) foreach ($app in $apps) { Write-Output "Trying to remove $app" Get-AppxPackage -AllUsers | Where-Object {$_.Name -Like $app} | Remove-AppxPackage -AllUsers -ErrorAction SilentlyContinue Get-AppxProvisionedPackage -Online | Where-Object {$_.DisplayName -Like $app} | Remove-AppxProvisionedPackage -Online -AllUsers -ErrorAction SilentlyContinue } # Remove certain Windows capabilities Get-WindowsCapability -online | Where-Object {$_.Name -like '*ContactSupport*'} | Remove-WindowsCapability -Online Get-WindowsCapability -online | Where-Object {$_.Name -like '*QuickAssist*'} | Remove-WindowsCapability -Online # Define and Call DisableServices Function Function DisableServices { Write-Host "Disabling some services..." $services = @( "ALG" "AJRouter" "AxInstSV" "BcastDVRUserService_48486de" "cbdhsvc_48486de" "diagnosticshub.standardcollector.service" "DiagTrack" "dmwappushservice" "DPS" "Fax" "fhsvc" "MapsBroker" "NetTcpPortSharing" "PcaSvc" "PhoneSvc" "RemoteAccess" "RemoteRegistry" "RetailDemo" "SCardSvr" "SEMgrSvc" "SysMain" "TrkWks" "WerSvc" "WMPNetworkSvc" "WpcMonSvc" "WPDBusEnum" "WpnService" "HPAppHelperCap" "HPDiagsCap" "HPNetworkCap" "HPSysInfoCap" "HpTouchpointAnalyticsService" "dcpm-notify" "DDVCollectorSvcApi" "DDVDataCollector" "DDVRulesProcessor" "Dell.CommandPowerManager.Service" "DellClientManagementService" "DellTechHub" "DPMService" "AdobeARMservice" "FoxitReaderUpdateService" "StateRepository" ) foreach ($service in $services) { $thisService = Get-Service -Name $service -ErrorAction SilentlyContinue if ($null -eq $thisService) { Write-Host "Service $service not found!" } else { Write-Host "Service $($thisService.Name) ($($thisService.DisplayName)) is in $($thisService.StartType) mode" if ($thisService.StartType -eq 'Automatic') { Write-Host "Stopping $service..." Stop-Service "$service" -WarningAction SilentlyContinue -ErrorAction SilentlyContinue Write-Host "Setting $service StartupType to Manual..." Set-Service "$service" -ErrorAction SilentlyContinue -StartupType Manual } } } } # List of app names and partial matches to remove $appsToRemove = @( "Microsoft 365 - pt-br", "Microsoft 365 - fr-fr", "Microsoft 365 - es-es", "Microsoft OneNote - es-es", "Microsoft OneNote - fr-fr", "Microsoft OneNote - pt-br", "Dell SupportAssist Remediation", "Dell SupportAssist OS Recovery Plugin for Dell Update", "Dell Pair", "Dell Optimizer", "Dell Trusted Device", "Dell.Digital.Delivery-64Bit", "Dell Core Services" ) Write-Host "`n=== Removing Store (Appx) Packages ===`n" foreach ($app in $appsToRemove) { # Remove AppxPackage if it's a Store app Get-AppxPackage -AllUsers | Where-Object { $_.Name -like "*$app*" -or $_.PackageFullName -like "*$app*" } | ForEach-Object { Write-Host "Removing Store App: $($_.Name)" Remove-AppxPackage -Package $_.PackageFullName -AllUsers -ErrorAction SilentlyContinue } } Write-Host "`n=== Removing Installed Programs via Get-CimInstance ===`n" foreach ($app in $appsToRemove) { $installedApps = Get-CimInstance -Class Win32_Product | Where-Object { $_.Name -like "*$app*" } foreach ($appInstance in $installedApps) { Write-Host "Uninstalling: $($appInstance.Name)" $appInstance | Invoke-CimMethod -MethodName Uninstall } } Write-Host "`n=== Removing Installed Programs via Get-Package ===`n" foreach ($app in $appsToRemove) { Get-Package | Where-Object { $_.Name -like "*$app*" } | ForEach-Object { Write-Host "Trying to uninstall (Package): $($_.Name)" Try { Uninstall-Package -Name $_.Name -Force -ErrorAction SilentlyContinue } Catch { Write-Warning "Could not uninstall: $($_.Name)" } } } # Call the function DisableServices Function DisableScheduledTasks { $tasks = @( # Windows base scheduled tasks "\Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319" "\Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319 64" "\Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319 64 Critical" "\Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319 Critical" "\Microsoft\Windows\AppID\SmartScreenSpecific" "\Microsoft\Windows\CloudExperienceHost\CreateObjectTask" "\Microsoft\Windows\Mobile Broadband Accounts\MNO Metadata Parser" ) Write-Output "Disabling scheduled tasks..." foreach ($task in $tasks) { $parts = $task.split('\') $name = $parts[-1] $path = $parts[0..($parts.length-2)] -join '\' Disable-ScheduledTask -TaskName "$name" -TaskPath "$path" -ErrorAction SilentlyContinue } } #Disable Telemetry Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0 Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0 Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0 #Disable Wi-Fi Sense If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting")) { New-Item -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Force | Out-Null } Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Name "Value" -Type DWord -Value 0 Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" -Name "Value" -Type DWord -Value 0 # Disable scheduled tasks Write-Output "Disabling Scheduled Tasks..." Get-ScheduledTask -TaskName Consolidator -ErrorAction SilentlyContinue | Disable-ScheduledTask Get-ScheduledTask -TaskName UsbCeip -ErrorAction SilentlyContinue | Disable-ScheduledTask Get-ScheduledTask -TaskName DmClient -ErrorAction SilentlyContinue | Disable-ScheduledTask Get-ScheduledTask -TaskName DmClientOnScenarioDownload -ErrorAction SilentlyContinue | Disable-ScheduledTask #Turn off Hibernation powercfg -h off # SSD life improvement Write-Output "Improve SSD life..." fsutil behavior set DisableLastAccess 1 fsutil behavior set EncryptPagingFile 0 # Show known file extensions Write-Output "Showing known file extensions..." Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 0 # Set the timezone Set-TimeZone -Id "Eastern Standard Time" -PassThru # Configure the time service to use an internet time server $timeServer = "time.windows.com" w32tm /config /manualpeerlist:$timeServer /syncfromflags:manual /update # Restart the Windows Time service to apply changes Restart-Service w32time # Force synchronization w32tm /resync # Verify synchronization status w32tm /query /status #Rename Computer Automatically $SerialNumber = (Get-CimInstance -ClassName Win32_BIOS).SerialNumber $computer = "Stock-$SerialNumber" Rename-Computer -NewName $computer -Force # Optimize User Interface Write-Output "Disable Game DVR and Game Bar" if (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR")) { New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR" -Force | Out-Null } Set-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR" "AllowgameDVR" 0 # Remove and disable OneDrive integration. Write-Output "Kill OneDrive process" taskkill.exe /F /IM "OneDrive.exe" taskkill.exe /F /IM "explorer.exe" Write-Output "Remove OneDrive" if (Test-Path "$env:systemroot\System32\OneDriveSetup.exe") { & "$env:systemroot\System32\OneDriveSetup.exe" /uninstall } if (Test-Path "$env:systemroot\SysWOW64\OneDriveSetup.exe") { & "$env:systemroot\SysWOW64\OneDriveSetup.exe" /uninstall } Write-Output "Removing OneDrive leftovers" Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$env:localappdata\Microsoft\OneDrive" Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$env:programdata\Microsoft OneDrive" Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$env:systemdrive\OneDriveTemp" # check if directory is empty before removing: If ((Get-ChildItem "$env:userprofile\OneDrive" -Recurse -ErrorAction SilentlyContinue | Measure-Object).Count -eq 0) { Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$env:userprofile\OneDrive" } Write-Output "Disable OneDrive via Group Policies" if (!(Test-Path "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\OneDrive")) { New-Item -Path "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\OneDrive" -Force | Out-Null } Set-ItemProperty "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\OneDrive" "DisableFileSyncNGSC" 1 Write-Output "Remove Onedrive from explorer sidebar" New-PSDrive -PSProvider "Registry" -Root "HKEY_CLASSES_ROOT" -Name "HKCR" if (!(Test-Path "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}")) { New-Item -Path "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Force | Out-Null } Set-ItemProperty "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" "System.IsPinnedToNameSpaceTree" 0 if (!(Test-Path "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}")) { New-Item -Path "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Force | Out-Null } Set-ItemProperty "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" "System.IsPinnedToNameSpaceTree" 0 Remove-PSDrive "HKCR" Write-Output "Removing startmenu entry" Remove-Item -Force -ErrorAction SilentlyContinue "$env:userprofile\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk" Write-Output "Removing scheduled task" Get-ScheduledTask -TaskPath '\' -TaskName 'OneDrive*' -ea SilentlyContinue | Unregister-ScheduledTask -Confirm:$false Write-Output "Restarting explorer" Start-Process "explorer.exe" Write-Output "Waiting for explorer to complete loading" Start-Sleep 10 #Removed 3-27-2026 #Write-Output "Removing additional OneDrive leftovers" #foreach ($item in (Get-ChildItem "$env:WinDir\WinSxS\*onedrive*" -ErrorAction SilentlyContinue)) { # takeown /f $item.FullName /r /d y # icacls $item.FullName /grant administrators:F /t # Remove-Item -Recurse -Force $item.FullName -ErrorAction SilentlyContinue #} Write-Output "Remove Taskbar Icons" REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v TaskbarMn /t REG_DWORD /d 0 REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v TaskbarDa /t REG_DWORD /d 0 # PowerShell script to hide Copilot button (if supported) $registryPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" $registryName = "TaskbarCopilot" # Set to 0 to hide Copilot button Set-ItemProperty -Path $registryPath -Name $registryName -Value 0 -ErrorAction SilentlyContinue Write-Output "Copilot button has been hidden. You may need to restart Explorer for changes to take effect." # PowerShell script to hide Task View button Set-ItemProperty -Path $registryPath -Name "ShowTaskViewButton" -Value 0 Write-Output "Task View button has been hidden. You may need to restart Explorer for changes to take effect." # PowerShell script to hide Widgets button Set-ItemProperty -Path $registryPath -Name "ShowWidgets" -Value 0 -ErrorAction SilentlyContinue # Disable Task View Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowTaskViewButton" -Value 0 Write-Output "Widgets button has been hidden. You may need to restart Explorer for changes to take effect." Stop-Process -Name explorer -Force Start-Process explorer # Function to set a registry value function Set-RegistryValue { param ( [string]$Key, [string]$Name, [int]$Value ) try { Set-ItemProperty -Path $Key -Name $Name -Value $Value Write-Output "Set $Name to $Value in $Key." } catch { Write-Output "Failed to set $Name in $Key." } } # Registry path for Performance Options $performanceKey = "HKCU:\Control Panel\Desktop" # Set to Best Performance (disable all) Write-Output "Configuring Performance Options for Best Performance..." Set-RegistryValue -Key $performanceKey -Name "VisualFXSetting" -Value 2 # Specific Visual Effects to Enable # Enable 'Show Thumbnails instead of icons' Set-RegistryValue -Key $performanceKey -Name "ThumbsDBFlags" -Value 1 # Enable 'Smooth Edges of screen fonts' Set-RegistryValue -Key $performanceKey -Name "FontSmoothing" -Value 2 # Enable 'Smooth-scroll list boxes' Set-RegistryValue -Key $performanceKey -Name "SmoothScroll" -Value 1 # Enable 'Use Drop Shadows for icon labels on desktop' Set-RegistryValue -Key $performanceKey -Name "IconTitleWrap" -Value 1 Write-Output "Performance Options have been configured. You may need to restart for changes to take effect." # Remove the specified registry key under SPP Clients Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SPP\Clients" -Name "{09F7EDC5-294E-4180-AF6A-FB0E6A0E9513}" -ErrorAction SilentlyContinue # Set RPSessionInterval to 0 in SystemRestore Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" -Name "RPSessionInterval" -Value 0 -Type DWord # Confirm changes Write-Host "Registry modifications applied successfully." # Disable Windows Visual Effects (Performance settings) Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "VisualFXSetting" -Value 2 -Type DWord # Disable animations when minimizing and maximizing windows Set-ItemProperty -Path "HKCU:\Control Panel\Desktop\WindowMetrics" -Name "MinAnimate" -Value "0" -Type String # Disable animations in Taskbar and Start Menu (Current User) Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarAnimations" -Value 0 -Type DWord # Remove TaskbarAnimations from Local Machine (if exists) Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarAnimations" -ErrorAction SilentlyContinue # Disable desktop composition Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\DWM" -Name "CompositionPolicy" -Value 0 -Type DWord # Enable transparent glass Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\DWM" -Name "ColorizationOpaqueBlend" -Value 0 -Type DWord # Disable Taskbar Thumbnail Previews Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\DWM" -Name "AlwaysHibernateThumbnails" -Value 1 -Type DWord # Enable Explorer Thumbnails (Show thumbnails instead of icons) Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "DisableThumbnails" -Value 0 -Type DWord # Disable translucent selection rectangle Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ListviewAlphaSelect" -Value 0 -Type DWord # Disable showing window contents while dragging Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "DragFullWindows" -Value 0 -Type String # Enable smooth edges of screen fonts Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "FontSmoothing" -Value "2" -Type String # Enable smooth-scroll list boxes Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "SmoothScroll" -Value 1 -Type String # Enable drop shadows for icon labels on the desktop Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ListviewShadow" -Value 1 -Type DWord #Disable Restore Disable-ComputerRestore -Drive "C:\" # Check for updates Write-Output "Installing tools for Updates" Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted -Force Install-PackageProvider -Name NuGet -Force Install-Module -Name PSWindowsUpdate -Force Import-Module PSWindowsUpdate # Update Winget Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery -AllowClobber Import-Module microsoft.winget.client Repair-WinGetPackageManager -AllUsers winget source update #Winget Install Adobe winget install -e --id Adobe.Acrobat.Reader.64-bit --accept-source-agreements --accept-package-agreements --silent #Winget Install intel winget install -e --id Intel.IntelDriverAndSupportAssistant --accept-source-agreements --accept-package-agreements --silent #Winget Install Dell Updater #winget install -e --id Dell.CommandUpdate --accept-source-agreements --accept-package-agreements --silent #Winget Install Chrome winget install -e --id Google.Chrome --accept-source-agreements --accept-package-agreements --silent Start-Sleep -seconds 30 #Upgrade WinGet winget upgrade --all --accept-source-agreements --accept-package-agreements --silent # Unpin Apps function UnPin-App { param([string]$AppName) try { $shell = New-Object -Com Shell.Application # Virtual folder for all Applications $folder = $shell.NameSpace("shell:::{4234d49b-0245-4df3-b780-3893943456e1}") $item = $folder.Items() | Where-Object { $_.Name -match $AppName } if ($item) { # Find the 'Unpin from taskbar' verb (handles both English and localized UI) $verb = $item.Verbs() | Where-Object { $_.Name.Replace('&', '') -match "Unpin from taskbar" } if ($verb) { $verb.DoIt() Write-Host "Unpinned $AppName" -ForegroundColor DarkGray } } } catch { # FIX: Used ${ _ } to prevent the variable reference error Write-Warning "Failed to unpin $AppName. Error: ${ _ }" } } # Execute UnPin-App "Microsoft Store" UnPin-App "Outlook" # Disable Widgets $registryPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" if (Test-Path $registryPath) { Set-ItemProperty -Path $registryPath -Name "TaskbarDa" -Value 0 Write-Host "Taskbar Widgets disabled." -ForegroundColor Green } Write-Output "Disabling Widgets..." # Policy (HKLM) - applies regardless of user New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Dsh" -Force | Out-Null Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Dsh" -Name "AllowNewsAndInterests" -Type DWord -Value 0 # Per-user taskbar button off (current user) $adv = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" If (!(Test-Path $adv)) { New-Item $adv -Force | Out-Null } Set-ItemProperty -Path $adv -Name "TaskbarDa" -Type DWord -Value 0 # Refresh Explorer to apply changes immediately Stop-Process -Name explorer -Force # Set Adobe Acrobat as default PDF viewer Write-Output "Setting Adobe Acrobat as default PDF viewer..." $setUserFTA = Join-Path $downloadsDir "SetUserFTA.exe" if (Test-Path $setUserFTA) { Start-Process $setUserFTA -ArgumentList ".pdf AcroExch.Document.DC" -Wait -WindowStyle Hidden Write-Output "Adobe Acrobat set as default PDF viewer." } else { Write-Output "WARNING: SetUserFTA.exe not found. Skipping default PDF setup." } # Pin Chrome to Taskbar Write-Output "Creating scheduled task to pin Chrome to taskbar at first logon..." $taskAction = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument @" -WindowStyle Hidden -Command " Start-Sleep -Seconds 15 \$shell = New-Object -ComObject Shell.Application \$folder = \$shell.Namespace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}') \$item = \$folder.Items() | Where-Object { \$_.Name -eq 'Google Chrome' } if (\$item) { \$verb = \$item.Verbs() | Where-Object { \$_.Name.Replace('&','') -match 'Pin to taskbar' } if (\$verb) { \$verb.DoIt() } } Unregister-ScheduledTask -TaskName 'PinChromeToTaskbar' -Confirm:\$false " "@ $taskTrigger = New-ScheduledTaskTrigger -AtLogOn $taskSettings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit (New-TimeSpan -Minutes 5) $taskPrincipal = New-ScheduledTaskPrincipal -GroupId "Users" -RunLevel Limited Register-ScheduledTask -TaskName "PinChromeToTaskbar" ` -Action $taskAction ` -Trigger $taskTrigger ` -Settings $taskSettings ` -Principal $taskPrincipal ` -Force | Out-Null Write-Output "Chrome pin task registered." # Windows Store Updates $namespaceName = "root\cimv2\mdm\dmmap" $className = "MDM_EnterpriseModernAppManagement_AppManagement01" $wmiObj = Get-CimInstance -Namespace $namespaceName -ClassName $className $result = Invoke-CimMethod -InputObject $wmiObj -MethodName UpdateScanMethod # Search for updates for Microsoft products Write-Output "Attempting to Turn on Updates for all Products" $ServiceManager = New-Object -ComObject Microsoft.Update.ServiceManager $ServiceManager.ClientApplicationID = "My App" $NewUpdateService = $ServiceManager.AddService2("7971f918-a847-4430-9279-4a52d1efe18d",7,"") Write-Output "Installing MS updates -- Do not restart 1 of 4" Get-WindowsUpdate -MicrosoftUpdate -AcceptAll -IgnoreReboot # Install updates for Microsoft products Write-Output "Installing MS updates -- DO not restart 2 of 4" Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -IgnoreReboot # Search for optional updates Write-Output "Installing MS updates -- Do not restart 3 of 4" Get-WindowsUpdate -Category "Optional" -AcceptAll -IgnoreReboot # Install optional updates Write-Output "Installing MS updates -- Do not restart 4 of 4" Install-WindowsUpdate -Category "Optional" -AcceptAll -IgnoreReboot # Check for pending driver updates and install them Write-Output "Checking for driver updates..." $driverUpdates = Get-WindowsUpdate -Category "Driver" -AcceptAll -IgnoreReboot if ($driverUpdates.Count -gt 0) { Write-Output "Installing driver updates..." Install-WindowsUpdate -Category "Driver" -AcceptAll -IgnoreReboot } Get-WindowsUpdate -MicrosoftUpdate -AcceptAll Install-WindowsUpdate -AcceptAll -Install -IgnoreReboot -Verbose Stop-Transcript # Force a reboot to complete driver updates Write-Output "Rebooting to complete driver updates..." Restart-Computer -Force