rimozione telemetria, corretto copia supremo su desktop pubblico, creato ciclo di verifica esistenza parametro di registro, corretto powerplan

This commit is contained in:
dado
2025-10-11 18:46:41 +02:00
parent d627c54615
commit 42562b8bec

View File

@@ -1,8 +1,6 @@
# https://github.com/andrew-s-taylor/public/blob/main/De-Bloat/RemoveBloat.ps1
# https://github.com/marlock9/edge-debloat/blob/main/edge-debloat.reg
# TODO
# export registry, supremo.exe, vendor bloatware
# https://github.com/Raphire/Win11Debloat/tree/master/Regfiles
clear-Host
@@ -26,34 +24,7 @@ Write-Host -ForegroundColor Yellow "
"
# Sleep for 5 seconds
Start-Sleep -Seconds 10
clear-Host
##########################################################################################
# #
# Software #
# #
##########################################################################################
# https://winstall.app/ - Browse the winget repository
Write-Host ""
Write-Host -ForegroundColor Yellow ">>> Upgrade packages... <<<"
Write-Host ""
winget upgrade --all
Write-Host ""
Write-Host -ForegroundColor Yellow ">>> Install default software... <<<"
Write-Host ""
winget install --disable-interactivity Microsoft.PowerShell Adobe.Acrobat.Reader.64-bit IZArc.IZArc Oracle.JavaRuntimeEnvironment Google.Chrome 7zip.7zip Microsoft.VCRedist.2010.x64 --source winget
Write-Host -ForegroundColor DarkGray ">>> Copy 'Supremo' to Public Desktop <<<"
$supremo_path=".\supremo.exe"
If (Test-Path $supremo_path ) {
Copy-Item -Path "$supremo_path" -Destination "C:\Users\Public\Desktop\supremo.exe"
}
Write-Host ""
Start-Sleep -Seconds 5
##########################################################################################
# #
@@ -70,8 +41,8 @@ $RegistryPaths = @(
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search",
"HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer",
"HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer"
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer",
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer"
)
# Set left align
@@ -100,6 +71,29 @@ Write-Host -ForegroundColor DarkGray ">>> Disable the 'Windows + W' keyboard sho
Set-ItemProperty -Path $RegistryPaths[3] -Name "ShowWindowsW" -Value 0 | Out-Null
Set-ItemProperty -Path $RegistryPaths[4] -Name "ShowWindowsW" -Value 0 | Out-Null
# Disable the widget service
Write-Host -ForegroundColor DarkGray ">>> Disable widget service <<<"
$widgetPath1 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\NewsAndInterests"
$widgetPath2 = "HKLM:\SOFTWARE\Policies\Microsoft\Dsh"
# Create the path if it doesn't exist
if (-not (Test-Path $widgetPath1)) {
New-Item -Path $widgetPath1 -Force | Out-Null
}
if (-not (Test-Path $widgetPath2)) {
New-Item -Path $widgetPath2 -Force | Out-Null
}
# Set the registry key
Set-ItemProperty -Path $widgetPath1 -Name "AllowNewsAndInterests" -Value 0 -Type DWORD -Force | Out-Null
New-ItemProperty -Path $widgetPath2 -Name "AllowNewsAndInterests" -Value 0 -Type DWORD -Force | Out-Null
# Enable End Task
Write-Host -ForegroundColor DarkGray ">>> Enable End Task <<<"
$endTaskPath = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
Set-ItemProperty -Path $endTaskPath -Name "TaskbarEndTask" -Value 1 -Type DWORD -Force | Out-Null
# Remove Chat from the Taskbar
Write-Host -ForegroundColor DarkGray ">>> Removes Chat from the Taskbar <<<"
foreach ($path in $RegistryPaths[0..1]) {
@@ -107,34 +101,69 @@ foreach ($path in $RegistryPaths[0..1]) {
}
# Disabling 'Recommended' section
Write-Host -ForegroundColor DarkGray ">>> Disabling 'Recommended' section <<<"
Write-Host -ForegroundColor DarkGray ">>> Hide 'Recommended' section <<<"
foreach ($path in $RegistryPaths) {
New-ItemProperty -Path $path -Name "Start_IrisRecommendations" -Value 0 -Type DWORD -Force | Out-Null
New-ItemProperty -Path $path -Name "Start_TrackDocs" -Value 0 -Type DWORD -Force | Out-Null
New-ItemProperty -Path $path -Name "Start_Layout" -Value 1 -Type DWORD -Force | Out-Null
}
$explorerPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer"
$startPath = "HKLM:\SOFTWARE\Microsoft\PolicyManager\current\device\Start"
$educationPath = "HKLM:\SOFTWARE\Microsoft\PolicyManager\current\device\Education"
# Create the Explorer path if it doesn't exist
if (-not (Test-Path $explorerPath)) {
New-Item -Path $explorerPath -Force | Out-Null
}
# Set the registry value to hide the Recommended Section in Explorer
Set-ItemProperty -Path $explorerPath -Name "HideRecommendedSection" -Value 1 -Type DWORD -Force | Out-Null
# Create the Start path if it doesn't exist
if (-not (Test-Path $startPath)) {
New-Item -Path $startPath -Force | Out-Null
}
# Set the registry value to hide the Recommended Section in Start
Set-ItemProperty -Path $startPath -Name "HideRecommendedSection" -Value 1 -Type DWORD -Force | Out-Null
# Create the Education path if it doesn't exist
if (-not (Test-Path $educationPath)) {
New-Item -Path $educationPath -Force | Out-Null
}
# Set the registry value for Education Environment
Set-ItemProperty -Path $educationPath -Name "IsEducationEnvironment" -Value 1 -Type DWORD -Force | Out-Null
Write-Host ""
# Define the registry paths for TaskbarDa
# Turn off web results in the Start menu
Write-Host -ForegroundColor Yellow ">>> Turn off web results in the Start menu <<<"
# Set the registry paths
$RegistryPaths = @(
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
"HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Search",
"HKCU:SOFTWARE\Policies\Microsoft\Windows\Explorer"
)
$Properties = @{
"SearchboxTaskbarMode" = 0
"BingSearchEnabled" = 0
"DisableSearchBoxSuggestions" = 1
}
# Iterate over each registry path
foreach ($taskbarDa_path in $RegistryPaths) {
# Check if the TaskbarDa property exists and remove it if it does
If (Test-Path "$taskbarDa_path\TaskbarDa") {
Remove-ItemProperty -Path $taskbarDa_path -Name "TaskbarDa" -Force | Out-Null
foreach ($RegistryPath in $RegistryPaths) {
# Create the key if it does not exist
If (-NOT (Test-Path $RegistryPath)) {
New-Item -Path $RegistryPath -Force | Out-Null
}
# Set the values based on the hashtable
foreach ($Name in $Properties.Keys) {
$Value = $Properties[$Name]
New-ItemProperty -Path $RegistryPath -Name $Name -Value $Value -PropertyType DWORD -Force | Out-Null
}
}
# Turn off web results in the Start menu
reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search /v SearchboxTaskbarMode /t REG_DWORD /d 0 /f
reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search /v BingSearchEnabled /t REG_DWORD /d 0 /f
reg add HKCU\SOFTWARE\Policies\Microsoft\Windows\Explorer /v DisableSearchBoxSuggestions /t REG_DWORD /d 1 /f
Write-Host ""
##########################################################################################
# #
@@ -144,9 +173,9 @@ reg add HKCU\SOFTWARE\Policies\Microsoft\Windows\Explorer /v DisableSearchBoxSug
Write-Host -ForegroundColor Yellow ">>> Configure File Explorer <<<"
Write-Host ""
Write-Host -ForegroundColor DarkGray ">>> Set File Explorer to Open to This PC Instead of Quick Access <<<"
Write-Host -ForegroundColor DarkGray ">>> Open 'This PC' instead of 'Quick Access' <<<"
Write-Host -ForegroundColor DarkGray ">>> Enable Compact View <<<"
Write-Host -ForegroundColor DarkGray ">>> Show file extensions in Explorer <<<"
Write-Host -ForegroundColor DarkGray ">>> Show file extensions <<<"
# Set the registry paths for both HKLM and HKCU
$RegistryPaths = @(
@@ -175,6 +204,29 @@ foreach ($RegistryPath in $RegistryPaths) {
}
}
# Disable Group By Folder in Windows Explorer
Write-Host -ForegroundColor DarkGray ">>> Disabling Group By Folder feature <<<"
# Registry path for disabling automatic grouping
$groupByPath = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
# Create the path if it doesn't exist
if (-not (Test-Path $groupByPath)) {
New-Item -Path $groupByPath -Force | Out-Null
}
# Set the registry value to disable auto grouping
Set-ItemProperty -Path $groupByPath -Name "UseAutoGrouping" -Value 0 -Type DWORD -Force | Out-Null
# Enable Dark Mode in Windows
Write-Host -ForegroundColor DarkGray ">>> Enable Dark Mode <<<"
# Registry path for dark mode
$darkModePath = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
# Create the path if it doesn't exist
if (-not (Test-Path $darkModePath)) {
New-Item -Path $darkModePath -Force | Out-Null
}
# Set the registry values to enable dark mode
Set-ItemProperty -Path $darkModePath -Name "AppsUseLightTheme" -Value 0 -Type DWORD -Force | Out-Null
Set-ItemProperty -Path $darkModePath -Name "SystemUsesLightTheme" -Value 0 -Type DWORD -Force | Out-Null
##########################################################################################
# #
# Spotlight #
@@ -187,10 +239,10 @@ Write-Host ""
# Define registry paths for Windows Spotlight settings
$RegistryPaths = @(
"HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
"HKLM:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
"HKCU:\Software\Policies\Microsoft\Windows\CloudContent",
"HKLM:\Software\Policies\Microsoft\Windows\CloudContent"
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
"HKCU:\SOFTWARE\Policies\Microsoft\Windows\CloudContent",
"HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
)
# Disable Windows Spotlight on lockscreen
@@ -211,6 +263,35 @@ foreach ($spotlight in $RegistryPaths[2..3]) {
}
}
##########################################################################################
# #
# Telemetry #
# #
##########################################################################################
# Configure Windows telemetry and activity tracking settings
Write-Host -ForegroundColor DarkGray ">>> Configuring telemetry and activity settings <<<"
# Define registry paths and values to modify
$registryEntries = @(
@{ Path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection"; Name = "AllowTelemetry"; Value = 0 },
@{ Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"; Name = "Start_TrackProgs"; Value = 0 },
@{ Path = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System"; Name = "PublishUserActivities"; Value = 0 },
@{ Path = "HKCU:\SOFTWARE\Microsoft\Siuf\Rules"; Name = "NumberOfSIUFInPeriod"; Value = 0 },
@{ Path = "HKCU:\SOFTWARE\Microsoft\Siuf\Rules"; Name = "PeriodInNanoSeconds"; Value = -1 }
)
# Loop through each registry entry and set the values
foreach ($entry in $registryEntries) {
# Create the path if it doesn't exist
if (-not (Test-Path $entry.Path)) {
New-Item -Path $entry.Path -Force | Out-Null
}
# Set the registry value
Set-ItemProperty -Path $entry.Path -Name $entry.Name -Value $entry.Value -Type DWORD -Force | Out-Null
}
##########################################################################################
# #
# Lock Screen Notifications #
@@ -224,7 +305,7 @@ Write-Host -ForegroundColor Yellow ">>> Disable Notifications on Lock Screen <<<
$RegistryPaths = @(
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings",
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings",
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications"
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications",
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications"
)
@@ -288,14 +369,45 @@ Write-Host ""
##########################################################################################
# #
# Welcome Experience #
# Suggestion #
# #
##########################################################################################
Write-Host -ForegroundColor Yellow ">>> Turn off Windows Welcome Experience <<<"
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent" -Value "0" -Type DWORD -Force | Out-Null
Write-Host ""
# Disable Windows notifications, suggestions, and ads
Write-Host -ForegroundColor DarkGray ">>> Turn off Welcome Experience, notifications, suggestions, and ads in Windows <<<"
# Define registry paths and values to modify
$registryEntries = @(
@{ Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; Name = "SubscribedContent-310093Enabled"; Value = 0 },
@{ Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; Name = "SubscribedContent-338388Enabled"; Value = 0 },
@{ Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; Name = "SystemPaneSuggestionsEnabled"; Value = 0 },
@{ Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; Name = "SubscribedContent-338389Enabled"; Value = 0 },
@{ Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; Name = "SoftLandingEnabled"; Value = 0 },
@{ Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; Name = "SubscribedContent-338393Enabled"; Value = 0 },
@{ Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; Name = "SubscribedContent-353694Enabled"; Value = 0 },
@{ Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; Name = "SubscribedContent-353696Enabled"; Value = 0 },
@{ Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; Name = "SubscribedContent-353698Enabled"; Value = 0 },
@{ Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications"; Name = "EnableAccountNotifications"; Value = 0 },
@{ Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\UserProfileEngagement"; Name = "ScoobeSystemSettingEnabled"; Value = 0 },
@{ Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"; Name = "ShowSyncProviderNotifications"; Value = 0 },
@{ Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"; Name = "SilentInstalledAppsEnabled"; Value = 0 },
@{ Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.Suggested"; Name = "Enabled"; Value = 0 },
@{ Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Mobility"; Name = "OptedIn"; Value = 0 },
@{ Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"; Name = "Start_AccountNotifications"; Value = 0 }
)
# Loop through each registry entry and set the values
foreach ($entry in $registryEntries) {
# Create the path if it doesn't exist
if (-not (Test-Path $entry.Path)) {
New-Item -Path $entry.Path -Force | Out-Null
}
# Set the registry value
Set-ItemProperty -Path $entry.Path -Name $entry.Name -Value $entry.Value -Type DWORD -Force | Out-Null
}
##########################################################################################
# #
@@ -305,33 +417,41 @@ Write-Host ""
Write-Host -ForegroundColor Yellow ">>> Disable Microsoft Edge First Run Welcome Page <<<"
# Set the registry paths for both HKLM and HKCU
# Set the registry paths
$RegistryPaths = @(
"HKLM:\SOFTWARE\Policies\Microsoft\Edge",
"HKCU:\SOFTWARE\Policies\Microsoft\Edge"
)
# https://gist.github.com/asheroto/e18500e7d206f3ae99f9bd0da0cf6bc6
# Create a hashtable to store the property names and their corresponding values
$EdgeProperties = @{
"NewTabPageHideDefaultTopSites" = 1
"HideFirstRunExperience" = 1
"ShowRecommendationsEnabled" = 0
"AlternateErrorPagesEnabled" = 0
"ComposeInlineEnabled" = 0
"CopilotCDPPageContext" = 0
"CopilotPageContext" = 0
"DefaultBrowserSettingsCampaignEnabled" = 0
"DiagnosticData" = 0
"EdgeCollectionsEnabled" = 0
"EdgeEntraCopilotPageContext" = 0
"EdgeHistoryAISearchEnabled" = 0
"EdgeShoppingAssistantEnabled" = 0
"GenAILocalFoundationalModelSettings" = 1
"HideFirstRunExperience" = 1
"HubsSidebarEnabled" = 0
"Microsoft365CopilotChatIconEnabled" = 0
"NewTabPageContentEnabled" = 0
"NewTabPageBingChatEnabled" = 0
"NewTabPageAllowedBackgroundTypes" = 3
"NewTabPageAppLauncherEnabled" = 0
"UserFeedbackAllowed" = 0
"NewTabPageBingChatEnabled" = 0
"NewTabPageContentEnabled" = 0
"NewTabPageHideDefaultTopSites" = 1
"PersonalizationReportingEnabled" = 0
"PersonalizeTopSitesInCustomizeSidebarEnabled" = 0
"EdgeCollectionsEnabled" = 0
"ShowMicrosoftRewards" = 0
"ShowAcrobatSubscriptionButton" = 0
"DefaultBrowserSettingsCampaignEnabled" = 0
"EdgeShoppingAssistantEnabled" = 0
"ShowMicrosoftRewards" = 0
"ShowRecommendationsEnabled" = 0
"TabServicesEnabled" = 0
"UserFeedbackAllowed" = 0
"VisualSearchEnabled" = 0
"NewTabPageAllowedBackgroundTypes" = 3
}
# Iterate over each registry path
@@ -352,30 +472,29 @@ Write-Host ""
##########################################################################################
# #
# Export Registry #
# Recall #
# #
##########################################################################################
## Export the registry keys
#Write-Host -ForegroundColor DarkGray ">>> Exporting registry settings... <<<"
#Write-Host -ForegroundColor Yellow ">>> Disable Recall <<<"
#
## Create a temporary folder for export
#$exportPath = "C:\temp"
#if (-Not (Test-Path $exportPath)) {
# New-Item -ItemType Directory -Path $exportPath | Out-Null
## Define registry paths for taskbar settings
#$RegistryPaths = @(
# "HKCU:\SOFTWARE\Policies\Microsoft\Windows\WindowsAI",
# "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsAI"
#)
#
## Disable AI data analysis
#Write-Host -ForegroundColor DarkGray ">>> Disable AI data analysis <<<"
#foreach ($path in $RegistryPaths[0..1]) {
# New-ItemProperty -Path $path -Name "DisableAIDataAnalysis" -Value 1 -Type DWORD -Force | Out-Null
#}
#
#reg export "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "$exportPath\TaskbarSettings.reg" /y | Out-Null
#reg export "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" "$exportPath\SearchSettings.reg" /y | Out-Null
#Set-ItemProperty -Path $RegistryPaths[1] -Name "AllowRecallEnablement" -Value 0 -Type DWORD -Force | Out-Null
#
#Write-Host -ForegroundColor DarkGray ">>> Importing registry settings to Default Profile <<<"
#
## Copy the registry files to the default profile
#Copy-Item "$exportPath\TaskbarSettings.reg" "C:\Users\Default\Desktop"
#Copy-Item "$exportPath\SearchSettings.reg" "C:\Users\Default\Desktop"
#
## Remove the temporary folder
#Remove-Item -Path $exportPath -Recurse -Force
## Turn off Recall snapshots
#Write-Host -ForegroundColor DarkGray ">>> Turn off Recall snapshots <<<"
#Set-ItemProperty -Path $RegistryPaths[1] -Name "TurnOffSavingSnapshots" -Value 1 -Type DWORD -Force | Out-Null
#
#Write-Host ""
@@ -388,8 +507,9 @@ Write-Host ""
Write-Host -ForegroundColor Yellow ">>> Power Plan <<<"
Write-Host ""
Write-Host -ForegroundColor DarkGray ">>> Activate High performance power plan <<<"
$powerPlan = Get-WmiObject -Namespace root\cimv2\power -Class Win32_PowerPlan -Filter "ElementName = 'High Performance'"
$powerPlan.Activate()
powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
# create ultimate powerscheme
powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61 | Out-Null
# AC power
powercfg -change -monitor-timeout-ac 10
@@ -413,8 +533,9 @@ Write-Host -ForegroundColor DarkGray ">>> Setting the sleep button behavior to '
powercfg /SETACVALUEINDEX SCHEME_CURRENT SUB_BUTTONS SBUTTONACTION 0
powercfg /SETDCVALUEINDEX SCHEME_CURRENT SUB_BUTTONS SBUTTONACTION 0
Write-Host -ForegroundColor DarkGray ">>> Disabling fast startup <<<"
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power" -Name HiberbootEnabled -Value "0" -Force | Out-Null
# Disable Fast Startup
Write-Host -ForegroundColor DarkGray ">>> Disable fast startup <<<"
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power" -Name "HiberbootEnabled" -Value "0" -Force | Out-Null
Write-Host -ForegroundColor DarkGray ">>> Disable Energy-Efficient Ethernet <<<"
$adapter = Get-NetAdapter | Where-Object { $_.Name -eq "Ethernet" }
@@ -444,37 +565,9 @@ catch {
####################################################################################################################################
Write-Host -ForegroundColor DarkGray ">>> Set the notification behavior for updates to 'Do not show any notifications (excluding restart notifications)' <<<"
$RegistryPath = "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings"
$RegistryName = "ConfigureNotificationsForWU"
$RegistryValue = 0 # Do not show any notifications (excluding restart notifications)
# Explanation of values for ConfigureNotificationsForWU:
# 0: Do not show any notifications (excluding restart notifications)
# 1: Show standard notifications (includes restart alerts)
# 2: Notify for download and installation
# 3: Disable all notifications
try {
# Check if the registry path exists
if (-not (Test-Path -Path $RegistryPath)) {
Write-Warning "The registry path '$RegistryPath' does not exist."
Write-Host "Windows Update may need to be initialized."
exit
}
# Set the registry value
Set-ItemProperty -Path $RegistryPath -Name $RegistryName -Value $RegistryValue -Force
}
catch {
Write-Error "An error occurred while modifying the registry: $($_.Exception.Message)"
}
####################################################################################################################################
# Set "Do not restart if user is logged on"
Write-Host -ForegroundColor DarkGray ">>> Set 'Do not restart if user is logged on' <<<"
# Define the value to disable automatic reboots when a user is logged on
$NoAutoRebootWithLoggedOnUsers = 1
$WindowsUpdateRegistryPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update"
@@ -489,9 +582,6 @@ Set-ItemProperty -Path $WindowsUpdateRegistryPath -Name "NoAutoRebootWithLoggedO
####################################################################################################################################
# Restart the Windows Update service to apply the change immediately
Restart-Service -Name "wuauserv" -Force | Out-Null
# Restart File Explorer to apply the changes
taskkill /f /im explorer.exe | Out-Null
start explorer.exe | Out-Null
@@ -530,33 +620,82 @@ Write-Host ""
# Get the directory of the currently executing script
$scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Path
# Construct the path to the bloatware-apps.txt file
# bloatware-apps.txt path
$appsToRemove = Get-Content (Join-Path $scriptDirectory "bloatware-apps.txt")
# Remove the specified apps from the list
foreach ($app in $appsToRemove) {
try {
winget uninstall --name $app
Write-Host "Removed: $app"
winget uninstall --name $app -h | Out-Null
# Check if the app was removed successfully
if ($LASTEXITCODE -eq 0) {
Write-Host "Removed: $app"
}
} catch {
Write-Host "Error removing: $app. Details: $_"
}
}
# Disable Microsoft 365 Ads in Settings Home
Write-Host -ForegroundColor DarkGray ">>> Disabling Microsoft 365 Ads <<<"
# Registry path for disabling ads
$adsPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
# Create the path if it doesn't exist
if (-not (Test-Path $adsPath)) {
New-Item -Path $adsPath -Force | Out-Null
}
# Set the registry value to disable ads
Set-ItemProperty -Path $adsPath -Name "DisableConsumerAccountStateContent" -Value 1 -Type DWORD -Force | Out-Null
# Uninstall Microsoft Office
Write-Host ""
Write-Host -ForegroundColor Yellow ">>> Uninstallation of Microsoft Office <<<"
Start-Process "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" "https://aka.ms/SaRA-officeUninstallFromPC"
Write-Host ""
# >>>>>> https://pureinfotech.com/windows-11-policy-remove-bloatware/ <<<<<<
Write-Host -ForegroundColor Yellow ">>> From Windows 24H2, enable the policy "
#Write-Host -ForegroundColor Yellow ">>> From Windows 24H2, enable the policy "
#Write-Host ""
#Write-Host -ForegroundColor Magenta "Computer Configuration > Administrative Templates > Windows Components > App Package Deployment > 'Remove Default Microsoft Store packages from the system' "
#Write-Host ""
#Write-Host -ForegroundColor Yellow "to prevent bloatware from being installed for every user... <<<"
#Write-Host ""
##########################################################################################
# #
# SOFTWARE #
# #
##########################################################################################
# https://winstall.app/ - Browse the winget repository
Write-Host ""
Write-Host -ForegroundColor Magenta "Computer Configuration > Administrative Templates > Windows Components > App Package Deployment > 'Remove Default Microsoft Store packages from the system' "
Write-Host -ForegroundColor Yellow ">>> Upgrade packages... <<<"
Write-Host ""
Write-Host -ForegroundColor Yellow "to prevent bloatware from being installed for every user... <<<"
winget upgrade --all
Write-Host ""
Write-Host -ForegroundColor Yellow ">>> Install default SOFTWARE... <<<"
Write-Host ""
winget install --disable-interactivity Microsoft.PowerShell SumatraPDF.SumatraPDF Oracle.JavaRuntimeEnvironment 7zip.7zip Microsoft.VCRedist.2010.x64 Mozilla.Firefox Notepad++.Notepad++ Flameshot.Flameshot --source winget
# NodirTemirkhodjaev.FortFirewall voidtools.Everything Flow-Launcher.Flow-Launcher AutoHotkey.AutoHotkey
Write-Host -ForegroundColor DarkGray ">>> Copy 'Supremo' to Public Desktop <<<"
# Get the directory where the script is located
$scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Path
# Define the path to the supremo executable
$supremo_path = Join-Path $scriptDirectory "supremo.exe"
If (Test-Path $supremo_path ) {
Copy-Item -Path "$supremo_path" -Destination "C:\Users\Public\Desktop\supremo.exe"
} else {
Write-Host -ForegroundColor Red "Error: File '$supremo_path' does not exist."
}
Write-Host ""
# Sleep for 30 seconds
Start-Sleep -Seconds 60
Start-Sleep -Seconds 30
##########################################################################################
# #