v4:
# Windows 11 System Optimizer
# Requires -RunAsAdministrator
# Requires -Version 5.0
[CmdletBinding()]
param(
[switch]$NoRestart,
[switch]$CreateRestorePoint
)
# Create restore point if requested
if ($CreateRestorePoint) {
Enable-ComputerRestore -Drive $env:SystemDrive
Checkpoint-Computer -Description "Before Windows 11 Optimization" -RestorePointType "MODIFY_SETTINGS"
}
# Remove Bloatware Apps
Get-AppxPackage | where-object {
$_.name –notlike "*calc*" -And
$_.name –notlike "*photos*" -And
$_.name –notlike "*store*" -And
$_.name –notlike "*Microsoft.UI.Xaml*" -And
$_.name –notlike "*Microsoft.VCLibs*" -And
$_.name –notlike "*Microsoft.NET.Native.Framework*" -And
$_.name –notlike "*Microsoft.NET.Native.Runtime*" -And
$_.name –notlike "*Microsoft.DesktopAppInstaller*" -And
$_.name –notlike "*Microsoft.WebpImageExtension*" -And
$_.name –notlike "*Microsoft.WebMediaExtensions*" -And
$_.name –notlike "*Microsoft.VP9VideoExtensions*" -And
$_.name –notlike "*Microsoft.HEIFImageExtension*" -And
$_.name –notlike "*screensketch*"
} | Remove-AppxPackage -ErrorAction SilentlyContinue
# Prevent Apps from Reinstalling
$deprovisionedPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Deprovisioned"
New-Item -Path $deprovisionedPath -Force
$appsToBlock = @(
"Microsoft.BingWeather_8wekyb3d8bbwe",
"Microsoft.GetHelp_8wekyb3d8bbwe",
"Microsoft.Getstarted_8wekyb3d8bbwe",
"Microsoft.Microsoft3DViewer_8wekyb3d8bbwe",
"Microsoft.MicrosoftOfficeHub_8wekyb3d8bbwe",
"Microsoft.MicrosoftSolitaireCollection_8wekyb3d8bbwe",
"Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe",
"Microsoft.MSPaint_8wekyb3d8bbwe",
"Microsoft.Office.OneNote_8wekyb3d8bbwe",
"Microsoft.OneConnect_8wekyb3d8bbwe",
"Microsoft.People_8wekyb3d8bbwe",
"Microsoft.Print3D_8wekyb3d8bbwe",
"Microsoft.SkypeApp_kzf8qxf38zg5c",
"Microsoft.Wallet_8wekyb3d8bbwe",
"Microsoft.WindowsCamera_8wekyb3d8bbwe",
"microsoft.windowscommunicationsapps_8wekyb3d8bbwe",
"Microsoft.WindowsFeedbackHub_8wekyb3d8bbwe",
"Microsoft.WindowsMaps_8wekyb3d8bbwe",
"Microsoft.Xbox.TCUI_8wekyb3d8bbwe",
"Microsoft.XboxApp_8wekyb3d8bbwe",
"Microsoft.XboxGameOverlay_8wekyb3d8bbwe",
"Microsoft.XboxIdentityProvider_8wekyb3d8bbwe",
"Microsoft.XboxSpeechToTextOverlay_8wekyb3d8bbwe",
"Microsoft.ZuneMusic_8wekyb3d8bbwe",
"Microsoft.ZuneVideo_8wekyb3d8bbwe",
"Microsoft.3DBuilder_8wekyb3d8bbwe",
"Microsoft.Messaging_8wekyb3d8bbwe"
)
foreach ($app in $appsToBlock) {
New-Item -Path "$deprovisionedPath\$app" -Force
}
# Configure System and Privacy Settings
$registrySettings = @{
"HKCU\Software\Microsoft\Office\16.0\Outlook\Options\General" = @{
"HideNewOutlookToggle" = 1
}
"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" = @{
"EnableAutoTray" = 0
}
"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" = @{
"ShowSyncProviderNotifications" = 0
"ShowTaskViewButton" = 0
"HideFileExt" = 0
}
"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" = @{
"BingSearchEnabled" = 0
"AllowSearchToUseLocation" = 0
"CortanaConsent" = 0
"SearchboxTaskbarMode" = 0
}
"HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" = @{
"RotatingLockScreenOverlayEnabled" = 0
"SoftLandingEnabled" = 0
"SubscribedContentEnabled" = 0
"SystemPaneSuggestionsEnabled" = 0
"ContentDeliveryAllowed" = 0
"FeatureManagementEnabled" = 0
"OemPreInstalledAppsEnabled" = 0
"PreInstalledAppsEnabled" = 0
"PreInstalledAppsEverEnabled" = 0
"SilentInstalledAppsEnabled" = 0
}
"HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" = @{
"AllowCloudSearch" = 0
"AllowCortana" = 0
"DisableWebSearch" = 1
}
"HKLM\SOFTWARE\Policies\Microsoft\Windows\CloudContent" = @{
"DisableCloudOptimizedContent" = 1
"DisableConsumerAccountStateContent" = 1
"DisableWindowsConsumerFeatures" = 1
}
"HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" = @{
"AllowTelemetry" = 0
}
"HKLM\SOFTWARE\Policies\Microsoft\Edge" = @{
"WebWidgetAllowed" = 0
"HubsSidebarEnabled" = 0
"EdgeShoppingAssistantEnabled" = 0
"ConfigureDoNotTrack" = 1
"SmartScreenEnabled" = 1
"SmartScreenPuaEnabled" = 1
}
"HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" = @{
"TargetReleaseVersion" = 1
"TargetReleaseVersionInfo" = "22H2"
}
}
foreach ($path in $registrySettings.Keys) {
if (-not (Test-Path "Registry::$path")) {
New-Item -Path "Registry::$path" -Force
}
foreach ($name in $registrySettings[$path].Keys) {
Set-ItemProperty -Path "Registry::$path" -Name $name -Value $registrySettings[$path][$name] -Type DWord -Force
}
}
# Performance Optimizations
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "VisualFXSetting" -Value 2
# Disable Superfetch
Stop-Service -Name "SysMain" -Force -ErrorAction SilentlyContinue
Set-Service -Name "SysMain" -StartupType Disabled
# System Cleanup
Remove-Item -Path "C:\Windows\Temp\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
Stop-Service -Name wuauserv -ErrorAction SilentlyContinue
Remove-Item -Path "C:\Windows\SoftwareDistribution\*" -Recurse -Force -ErrorAction SilentlyContinue
Start-Service -Name wuauserv -ErrorAction SilentlyContinue
# Restart prompt
if (-not $NoRestart) {
$restart = Read-Host "A restart is recommended to apply all changes. Would you like to restart now? (y/n)"
if ($restart -eq 'y') {
Restart-Computer -Force
}
}
v3:
# Windows 11 System Optimizer
# Requires -RunAsAdministrator
# Requires -Version 5.0
[CmdletBinding()]
param(
[switch]$NoRestart,
[switch]$Backup,
[switch]$Minimal,
[switch]$KeepEdge
)
# Initialize logging
$logFile = Join-Path $env:USERPROFILE "Desktop\windows_optimizer_$(Get-Date -Format 'yyyyMMdd_HHmmss').log"
Start-Transcript -Path $logFile
function Write-LogMessage {
param([string]$Message)
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Write-Host "[$timestamp] $Message"
}
function Write-ErrorAndExit {
param([string]$Message)
Write-LogMessage "ERROR: $Message"
Stop-Transcript
exit 1
}
function Create-RestorePoint {
Write-LogMessage "Creating system restore point..."
try {
Enable-ComputerRestore -Drive $env:SystemDrive
Checkpoint-Computer -Description "Before Windows 11 Optimization" -RestorePointType "MODIFY_SETTINGS"
} catch {
Write-LogMessage "Warning: Failed to create restore point. Continuing anyway..."
}
}
# Main optimization function
function Start-SystemOptimization {
Write-LogMessage "Starting Windows 11 optimization..."
# 1. Remove Bloatware Apps
Write-LogMessage "Removing unnecessary Windows apps..."
$appsToRemove = @(
"Clipchamp.Clipchamp"
"Microsoft.BingNews"
"Microsoft.BingWeather"
"Microsoft.GamingApp"
"Microsoft.GetHelp"
"Microsoft.Getstarted"
"Microsoft.MicrosoftOfficeHub"
"Microsoft.MicrosoftSolitaireCollection"
"Microsoft.People"
"Microsoft.PowerAutomateDesktop"
"Microsoft.Todos"
"Microsoft.WindowsAlarms"
"Microsoft.WindowsFeedbackHub"
"Microsoft.WindowsMaps"
"Microsoft.WindowsSoundRecorder"
"Microsoft.Xbox.TCUI"
"Microsoft.XboxGamingOverlay"
"Microsoft.XboxGameOverlay"
"Microsoft.XboxSpeechToTextOverlay"
"Microsoft.YourPhone"
"Microsoft.ZuneMusic"
"Microsoft.ZuneVideo"
"MicrosoftTeams"
)
foreach ($app in $appsToRemove) {
Write-LogMessage "Removing $app..."
Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -like "*$app*"} |
Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
}
# 2. Disable Telemetry and Privacy Settings
Write-LogMessage "Configuring privacy and telemetry settings..."
$privacySettings = @{
"HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" = @{
"AllowTelemetry" = 0
}
"HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" = @{
"Enabled" = 0
}
"HKCU:\Software\Microsoft\Windows\CurrentVersion\Privacy" = @{
"TailoredExperiencesWithDiagnosticDataEnabled" = 0
}
"HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" = @{
"DisableWindowsConsumerFeatures" = 1
"DisableConsumerAccountStateContent" = 1
"DisableCloudOptimizedContent" = 1
}
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" = @{
"ContentDeliveryAllowed" = 0
"FeatureManagementEnabled" = 0
"OemPreInstalledAppsEnabled" = 0
"PreInstalledAppsEnabled" = 0
"PreInstalledAppsEverEnabled" = 0
"SilentInstalledAppsEnabled" = 0
"SubscribedContent-338388Enabled" = 0
"SubscribedContent-338389Enabled" = 0
"SubscribedContent-353696Enabled" = 0
"SystemPaneSuggestionsEnabled" = 0
}
}
foreach ($path in $privacySettings.Keys) {
if (-not (Test-Path $path)) {
New-Item -Path $path -Force | Out-Null
}
foreach ($setting in $privacySettings[$path].GetEnumerator()) {
Set-ItemProperty -Path $path -Name $setting.Key -Value $setting.Value -Type DWord -Force
}
}
# 3. Disable Scheduled Tasks
Write-LogMessage "Disabling telemetry-related scheduled tasks..."
$tasksToDisable = @(
"\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser"
"\Microsoft\Windows\Application Experience\ProgramDataUpdater"
"\Microsoft\Windows\Autochk\Proxy"
"\Microsoft\Windows\Customer Experience Improvement Program\Consolidator"
"\Microsoft\Windows\Customer Experience Improvement Program\UsbCeip"
"\Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticDataCollector"
"\Microsoft\Windows\Feedback\Siuf\DmClient"
)
foreach ($task in $tasksToDisable) {
Disable-ScheduledTask -TaskName $task -ErrorAction SilentlyContinue | Out-Null
}
# 4. System Optimizations
Write-LogMessage "Applying system optimizations..."
$systemSettings = @{
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" = @{
"LaunchTo" = 1 # Open File Explorer to This PC
}
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" = @{
"HideFileExt" = 0 # Show file extensions
"ShowTaskViewButton" = 0 # Hide Task View button
}
"HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" = @{
"AllowCloudSearch" = 0
"DisableWebSearch" = 1
}
"HKLM:\SOFTWARE\Policies\Microsoft\Edge" = @{
"WebWidgetAllowed" = 0
"HubsSidebarEnabled" = 0
"EdgeShoppingAssistantEnabled" = 0
"ConfigureDoNotTrack" = 1
}
}
foreach ($path in $systemSettings.Keys) {
if (-not (Test-Path $path)) {
New-Item -Path $path -Force | Out-Null
}
foreach ($setting in $systemSettings[$path].GetEnumerator()) {
Set-ItemProperty -Path $path -Name $setting.Key -Value $setting.Value -Type DWord -Force
}
}
# 5. Performance Optimizations
if (-not $Minimal) {
Write-LogMessage "Applying performance optimizations..."
# Disable Visual Effects
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" `
-Name "VisualFXSetting" -Value 2
# Optimize Power Settings
powercfg /change monitor-timeout-ac 10
powercfg /change standby-timeout-ac 0
powercfg /change hibernate-timeout-ac 0
# Disable Superfetch
Stop-Service -Name "SysMain" -Force -ErrorAction SilentlyContinue
Set-Service -Name "SysMain" -StartupType Disabled -ErrorAction SilentlyContinue
}
# 6. System Cleanup
Write-LogMessage "Performing system cleanup..."
# Clear temporary files
Remove-Item -Path "C:\Windows\Temp\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
# Clear Windows Update cache
Stop-Service -Name wuauserv -ErrorAction SilentlyContinue
Remove-Item -Path "C:\Windows\SoftwareDistribution\*" -Recurse -Force -ErrorAction SilentlyContinue
Start-Service -Name wuauserv -ErrorAction SilentlyContinue
Write-LogMessage "Optimization complete!"
}
# Main execution
try {
Write-LogMessage "Windows 11 System Optimizer Starting..."
if ($Backup) {
Create-RestorePoint
}
Start-SystemOptimization
if (-not $NoRestart) {
$restart = Read-Host "A restart is recommended to apply all changes. Would you like to restart now? (y/n)"
if ($restart -eq 'y') {
Restart-Computer -Force
}
}
} catch {
Write-ErrorAndExit "An error occurred: $_"
} finally {
Stop-Transcript
}
v2:
# Windows 11 System Optimizer
# Run as administrator
#Requires -RunAsAdministrator
#Requires -Version 5.0
[CmdletBinding()]
param(
[switch]$NoRestart,
[switch]$Backup,
[switch]$Minimal,
[switch]$KeepEdge # Option to keep Edge browser
)
# Error handling function
function Write-ErrorAndExit {
param([string]$Message)
Write-Error $Message
exit 1
}
function Create-RestorePoint {
Write-Host "Creating system restore point..."
Enable-ComputerRestore -Drive $env:SystemDrive
Checkpoint-Computer -Description "Before Windows 11 Optimization" -RestorePointType "MODIFY_SETTINGS"
}
function Backup-Registry {
$backupPath = Join-Path $env:USERPROFILE "Documents\Windows11_Registry_Backup"
New-Item -ItemType Directory -Force -Path $backupPath | Out-Null
$date = Get-Date -Format "yyyyMMdd_HHmmss"
Write-Host "Backing up registry to $backupPath..."
reg export HKLM\SOFTWARE "$backupPath\HKLM_SOFTWARE_$date.reg" /y
reg export HKLM\SYSTEM "$backupPath\HKLM_SYSTEM_$date.reg" /y
reg export HKCU "$backupPath\HKCU_$date.reg" /y
}
try {
Write-Host "Windows 11 System Optimizer Starting..."
if ($Backup) {
Create-RestorePoint
Backup-Registry
}
# 1. Enhanced Bloatware Removal
Write-Host "Removing unnecessary apps..."
Get-AppxPackage | Where-Object {
$_.Name -notlike "*calc*" -and
$_.Name -notlike "*photos*" -and
$_.Name -notlike "*store*" -and
$_.Name -notlike "*Microsoft.UI.Xaml*" -and
$_.Name -notlike "*Microsoft.VCLibs*" -and
$_.Name -notlike "*Microsoft.NET.Native*" -and
$_.Name -notlike "*Microsoft.DesktopAppInstaller*" -and
$_.Name -notlike "*Microsoft.WebMediaExtensions*" -and
$_.Name -notlike "*Microsoft.VP9VideoExtensions*" -and
$_.Name -notlike "*Microsoft.HEIFImageExtension*" -and
$_.Name -notlike "*screensketch*"
} | Remove-AppxPackage -ErrorAction SilentlyContinue
# 2. Prevent Apps from Reinstalling
Write-Host "Preventing apps from reinstalling..."
$appsToBlock = @(
"Microsoft.BingWeather"
"Microsoft.GetHelp"
"Microsoft.Getstarted"
"Microsoft.MicrosoftOfficeHub"
"Microsoft.MicrosoftSolitaireCollection"
"Microsoft.People"
"Microsoft.WindowsFeedbackHub"
"Microsoft.WindowsMaps"
"Microsoft.Xbox.TCUI"
"Microsoft.XboxGameOverlay"
"Microsoft.ZuneMusic"
"Microsoft.ZuneVideo"
)
foreach ($app in $appsToBlock) {
$regPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Deprovisioned\$app"
New-Item -Path $regPath -Force | Out-Null
}
# 3. Enhanced Registry Optimizations
Write-Host "Applying registry optimizations..."
$registryOptimizations = @{
# Outlook Options
"HKCU:\Software\Microsoft\Office\16.0\Outlook\Options\General" = @{
"HideNewOutlookToggle" = 1
}
# Explorer Settings
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" = @{
"ShowSyncProviderNotifications" = 0
"ShowTaskViewButton" = 0
"HideFileExt" = 0
"LaunchTo" = 1
}
# Search Settings
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" = @{
"BingSearchEnabled" = 0
"AllowSearchToUseLocation" = 0
"CortanaConsent" = 0
"SearchboxTaskbarMode" = 0
}
# Privacy Settings
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" = @{
"Enabled" = 0
}
# Content Delivery Settings
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" = @{
"RotatingLockScreenOverlayEnabled" = 0
"SoftLandingEnabled" = 0
"ContentDeliveryAllowed" = 0
"FeatureManagementEnabled" = 0
"OemPreInstalledAppsEnabled" = 0
"PreInstalledAppsEnabled" = 0
"PreInstalledAppsEverEnabled" = 0
"SilentInstalledAppsEnabled" = 0
"SystemPaneSuggestionsEnabled" = 0
}
# Edge Policies (if not keeping Edge)
"HKLM:\SOFTWARE\Policies\Microsoft\Edge" = @{
"WebWidgetAllowed" = 0
"HubsSidebarEnabled" = 0
"EdgeShoppingAssistantEnabled" = 0
"ConfigureDoNotTrack" = 1
"SmartScreenEnabled" = 1
"SmartScreenPuaEnabled" = 1
}
# System Policies
"HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" = @{
"DisableCloudOptimizedContent" = 1
"DisableWindowsConsumerFeatures" = 1
}
# Windows Update Settings
"HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" = @{
"TargetReleaseVersion" = 1
"TargetReleaseVersionInfo" = "22H2"
}
}
foreach ($path in $registryOptimizations.Keys) {
if (-not (Test-Path $path)) {
New-Item -Path $path -Force | Out-Null
}
$registryOptimizations[$path].GetEnumerator() | ForEach-Object {
Set-ItemProperty -Path $path -Name $_.Key -Value $_.Value -Type DWord
}
}
# 4. Performance Optimizations
Write-Host "Applying performance optimizations..."
# Disable Visual Effects
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "VisualFXSetting" -Value 2
# Optimize Power Settings
powercfg /change monitor-timeout-ac 10
powercfg /change standby-timeout-ac 0
powercfg /change hibernate-timeout-ac 0
# 5. Background Apps and Services
if (-not $Minimal) {
Write-Host "Optimizing background services..."
$servicesToDisable = @(
"DiagTrack" # Connected User Experiences and Telemetry
"dmwappushservice" # Device Management Wireless Application Protocol
"SysMain" # Superfetch
"WSearch" # Windows Search
)
foreach ($service in $servicesToDisable) {
Stop-Service -Name $service -Force -ErrorAction SilentlyContinue
Set-Service -Name $service -StartupType Disabled -ErrorAction SilentlyContinue
}
}
# 6. System Cleanup
Write-Host "Cleaning up system..."
# Clear temporary files
Remove-Item -Path "C:\Windows\Temp\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
# Clear Windows Update cache
Stop-Service -Name wuauserv
Remove-Item -Path "C:\Windows\SoftwareDistribution\*" -Recurse -Force -ErrorAction SilentlyContinue
Start-Service -Name wuauserv
Write-Host "Optimization complete!"
if (-not $NoRestart) {
$restart = Read-Host "A restart is recommended to apply all changes. Would you like to restart now? (y/n)"
if ($restart -eq 'y') {
Restart-Computer -Force
}
}
} catch {
Write-ErrorAndExit "An error occurred: $_"
}
v1:
# Requires -RunAsAdministrator
Write-Host "Windows 11 System Optimizer"
Write-Host "-------------------------"
Write-Host "This script will optimize your Windows 11 installation."
# Check if running as admin
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
if (-not $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host "This script requires administrator privileges. Please run as administrator."
exit
}
# Start logging
Start-Transcript -Path "$env:USERPROFILE\Desktop\windows_optimizer.log"
# Create restore point
Write-Host "Creating system restore point..."
Checkpoint-Computer -Description "Before Windows 11 Optimization" -RestorePointType "MODIFY_SETTINGS"
Write-Host "Removing unnecessary Windows apps..."
$appsToRemove = @(
"Clipchamp.Clipchamp",
"Microsoft.BingNews",
"Microsoft.BingWeather",
"Microsoft.GamingApp",
"Microsoft.GetHelp",
"Microsoft.Getstarted",
"Microsoft.MicrosoftOfficeHub",
"Microsoft.MicrosoftSolitaireCollection",
"Microsoft.People",
"Microsoft.PowerAutomateDesktop",
"Microsoft.Todos",
"Microsoft.WindowsAlarms",
"Microsoft.WindowsFeedbackHub",
"Microsoft.WindowsMaps",
"Microsoft.WindowsSoundRecorder",
"Microsoft.Xbox.TCUI",
"Microsoft.XboxGamingOverlay",
"Microsoft.XboxGameOverlay",
"Microsoft.XboxSpeechToTextOverlay",
"Microsoft.YourPhone",
"Microsoft.ZuneMusic",
"Microsoft.ZuneVideo",
"MicrosoftTeams"
)
foreach ($app in $appsToRemove) {
Write-Host "Removing $app..."
Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -like "*$app*"} | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
}
Write-Host "Disabling telemetry and data collection..."
$telemetrySettings = @{
"HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" = @{
"AllowTelemetry" = 0
}
"HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" = @{
"Enabled" = 0
}
"HKCU:\Software\Microsoft\Windows\CurrentVersion\Privacy" = @{
"TailoredExperiencesWithDiagnosticDataEnabled" = 0
}
"HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" = @{
"DisableWindowsConsumerFeatures" = 1
"DisableConsumerAccountStateContent" = 1
"DisableCloudOptimizedContent" = 1
}
}
foreach ($path in $telemetrySettings.Keys) {
if (-not (Test-Path $path)) {
New-Item -Path $path -Force | Out-Null
}
foreach ($name in $telemetrySettings[$path].Keys) {
Set-ItemProperty -Path $path -Name $name -Value $telemetrySettings[$path][$name] -Type DWord -Force
}
}
Write-Host "Disabling scheduled tasks related to telemetry..."
$tasksToDisable = @(
"\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser",
"\Microsoft\Windows\Application Experience\ProgramDataUpdater",
"\Microsoft\Windows\Autochk\Proxy",
"\Microsoft\Windows\Customer Experience Improvement Program\Consolidator",
"\Microsoft\Windows\Customer Experience Improvement Program\UsbCeip",
"\Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticDataCollector",
"\Microsoft\Windows\Feedback\Siuf\DmClient"
)
foreach ($task in $tasksToDisable) {
Disable-ScheduledTask -TaskName $task -ErrorAction SilentlyContinue | Out-Null
}
Write-Host "Disabling Sponsored Apps and Start Menu Ads..."
$sponsoredAppsSettings = @{
"HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" = @{
"ContentDeliveryAllowed" = 0
"FeatureManagementEnabled" = 0
"OemPreInstalledAppsEnabled" = 0
"PreInstalledAppsEnabled" = 0
"PreInstalledAppsEverEnabled" = 0
"SilentInstalledAppsEnabled" = 0
"SubscribedContent-338388Enabled" = 0
"SubscribedContent-338389Enabled" = 0
"SubscribedContent-353696Enabled" = 0
"SystemPaneSuggestionsEnabled" = 0
}
}
foreach ($path in $sponsoredAppsSettings.Keys) {
if (-not (Test-Path $path)) {
New-Item -Path $path -Force | Out-Null
}
foreach ($name in $sponsoredAppsSettings[$path].Keys) {
Set-ItemProperty -Path $path -Name $name -Value $sponsoredAppsSettings[$path][$name] -Type DWord -Force
}
}
Write-Host "Disabling Chat icon..."
$chatIconPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Chat"
if (-not (Test-Path $chatIconPath)) {
New-Item -Path $chatIconPath -Force | Out-Null
}
Set-ItemProperty -Path $chatIconPath -Name "ChatIcon" -Value 3 -Type DWord -Force
Write-Host "Optimization complete! A log file has been created on your desktop."
Write-Host "Please restart your computer for all changes to take effect."
Stop-Transcript