# Install power scheme powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61 # Set power scheme as active and set sleep settings powercfg -setactive e9a42b02-d5df-448d-aa00-03f14749eb61 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 #### Custom 8-18-2023 ############ Download Programs ################### $downloadUrlPrefix = "https://cowetacomputers.com/downloads/" $downloadsDir = "C:\NPCDownloads" if (-not (Test-Path $downloadsDir)) { New-Item -ItemType Directory -Path $downloadsDir | Out-Null } $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") $webClient.DownloadFile(($downloadUrlPrefix + "AcroRdrDC.exe"), (Join-Path $downloadsDir "AcroRdrDC.exe")) $webClient.DownloadFile(($downloadUrlPrefix + "ChromeSetup.exe"), (Join-Path $downloadsDir "ChromeSetup.exe")) $webClient.DownloadFile(($downloadUrlPrefix + "Dell-Command-Update.EXE"), (Join-Path $downloadsDir "Dell-Command-Update.exe")) $webClient.DownloadFile(($downloadUrlPrefix + "Intel-Update.exe"), (Join-Path $downloadsDir "IntelUpdate.exe")) $webClient.DownloadFile(($downloadUrlPrefix + "new-setup.bat"), (Join-Path $downloadsDir "new-setup.bat")) $webClient.DownloadFile(($downloadUrlPrefix + "Tactical%20RMM%20-%20Installer.exe"), (Join-Path $downloadsDir "Tactical_rmm.exe")) # Install Programs Start-Process -FilePath (Join-Path $downloadsDir "AcroRdrDC.exe") -ArgumentList "/sAll /rs /rps /msi /norestart /quiet EULA_ACCEPT=YES" -Verb RunAs -Wait Start-Process -FilePath (Join-Path $downloadsDir "ChromeSetup.exe") -ArgumentList "/silent /install" -Verb RunAs -Wait Start-Process -FilePath (Join-Path $downloadsDir "Dell-Command-Update.exe") -ArgumentList "/s" -Verb RunAs -Wait Start-Process -FilePath (Join-Path $downloadsDir "IntelUpdate.exe") -ArgumentList "/silent /install EULA_ACCEPT=YES" -Verb RunAs -Wait Start-Process -FilePath (Join-Path $downloadsDir "new-setup.bat") -ArgumentList "/silent" -Verb RunAs -Wait Start-Process -FilePath (Join-Path $downloadsDir "Tactical_rmm.exe") -ArgumentList "-silent" -Verb RunAs -Wait #Disable UAC New-ItemProperty -Path HKLM:Software\Microsoft\Windows\CurrentVersion\policies\system -Name EnableLUA -PropertyType DWord -Value 0 -Force #Disable News & Interest in Taskbar Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Feeds -Name ShellFeedsTaskbarViewMode -Value 2 #Uninstall Uneeded 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 #"*AAD.BrokerPlugin*" "*DisneyMagicKingdoms*" "*HiddenCityMysteryofShadows*" "*MarchofEmpires*" #"*PPIProjection*" # 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 } # The following cannot be uninstalled using Remove-AppxPackage Get-WindowsCapability -online | Where-Object {$_.Name -like '*ContactSupport*'} | Remove-WindowsCapability -Online Get-WindowsCapability -online | Where-Object {$_.Name -like '*QuickAssist*'} | Remove-WindowsCapability -Online #Remove Xbox Apps foreach ($XboxFeaturesApp in $XboxFeaturesApps) { Get-AppxPackage -Name $XboxFeaturesApp -AllUsers | Remove-AppxPackage -AllUsers Get-AppXProvisionedPackage -Online | Where-Object DisplayName -EQ $XboxFeaturesApp | Remove-AppxProvisionedPackage -Online } #Disable Xbox gaming features Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_Enabled" -Type DWord -Value 0 If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR")) { New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR" } Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR" -Name "AllowGameDVR" -Type DWord -Value 0 #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 Bing Search in Start Menu Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -Type DWord -Value 0 If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search")) { New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Force | Out-Null } Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "DisableWebSearch" -Type DWord -Value 1 # Disable scheduled tasks Get-ScheduledTask -TaskName XblGameSaveTaskLogon | Disable-ScheduledTask Get-ScheduledTask -TaskName XblGameSaveTask | Disable-ScheduledTask Get-ScheduledTask -TaskName Consolidator | Disable-ScheduledTask Get-ScheduledTask -TaskName UsbCeip | Disable-ScheduledTask Get-ScheduledTask -TaskName DmClient | Disable-ScheduledTask Get-ScheduledTask -TaskName DmClientOnScenarioDownload | Disable-ScheduledTask #Reset Windows Store wsreset powercfg -h off #Disable Restore Disable-ComputerRestore -Drive "C:\" # SSD life improvement fsutil behavior set DisableLastAccess 1 fsutil behavior set EncryptPagingFile 0 #Set Timezone Set-TimeZone -Id "Eastern Standard Time" -PassThru #Rename Computer Automatically $SerialNumber = (Get-WmiObject -class win32_bios).SerialNumber $computer = "Stock-$SerialNumber" Rename-Computer -NewName $computer -Force # Set Google Chrome as the default browser Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" -Name "ProgId" -Value "ChromeHTML" Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice" -Name "ProgId" -Value "ChromeHTML" # Open a specific URL in the default browser $url = "https://cowetacomputers.com/script-successfully-completed/" # Replace with your desired URL Start-Process $url # Optimize User Interface Write-Output "Disable Game DVR and Game Bar" force-mkdir "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR" 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 | Measure-Object).Count -eq 0) { Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$env:userprofile\OneDrive" } Write-Output "Disable OneDrive via Group Policies" force-mkdir "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\OneDrive" 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" mkdir -Force "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" Set-ItemProperty "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" "System.IsPinnedToNameSpaceTree" 0 mkdir -Force "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" Set-ItemProperty "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" "System.IsPinnedToNameSpaceTree" 0 Remove-PSDrive "HKCR" Write-Output "Removing run hook for new users" reg load "hku\Default" "C:\Users\Default\NTUSER.DAT" reg delete "HKEY_USERS\Default\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "OneDriveSetup" /f reg unload "hku\Default" 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 Write-Output "Removing additional OneDrive leftovers" foreach ($item in (Get-ChildItem "$env:WinDir\WinSxS\*onedrive*")) { Takeown-Folder $item.FullName Remove-Item -Recurse -Force $item.FullName } # Check for updates Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted -Force Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force Install-Module -Name PSWindowsUpdate -Force Import-Module PSWindowsUpdate # Search for updates for Microsoft products Get-WindowsUpdate -MicrosoftUpdate -AcceptAll -IgnoreReboot # Install updates for Microsoft products Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -AutoReboot # Search for optional updates Get-WindowsUpdate -Category "Optional" -AcceptAll -IgnoreReboot # Install optional updates Install-WindowsUpdate -Category "Optional" -AcceptAll -AutoReboot