Compare commits
3 Commits
81b5e39e79
...
e4438cb8a6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4438cb8a6 | ||
|
|
99e6f9b237 | ||
|
|
96496d288e |
12
README.md
12
README.md
@@ -1,3 +1,13 @@
|
|||||||
# powershell-script
|
# powershell-script
|
||||||
|
|
||||||
A list of PowerShell scripts for configuring and debloating Windows
|
A list of PowerShell scripts for configuring and debloating Windows.
|
||||||
|
|
||||||
|
## First run
|
||||||
|
|
||||||
|
To allow the execution of scripts, but only for the local user, run the following command in a PowerShell window:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
|
||||||
|
```
|
||||||
|
|
||||||
|
Scripts downloaded from the Internet must be signed by a trusted entity, while local scripts can be executed without restrictions. This setting applies exclusively to the current user and does not affect the execution policies of other users on the system.
|
||||||
|
|||||||
@@ -1,28 +1,23 @@
|
|||||||
Microsoft.Windows.ParentalControls
|
Microsoft Clipchamp
|
||||||
Microsoft.Windows.PeopleExperienceHost
|
Microsoft Teams
|
||||||
Microsoft.XboxGameCallableUI
|
Microsoft News
|
||||||
Clipchamp.Clipchamp
|
Microsoft Bing
|
||||||
Microsoft.BingNews
|
MSN Weather
|
||||||
Microsoft.BingSearch
|
Microsoft Edge Game Assist
|
||||||
Microsoft.BingWeather
|
Xbox
|
||||||
Microsoft.Edge.GameAssist
|
Microsoft 365 Copilot
|
||||||
Microsoft.GamingApp
|
Solitaire & Casual Games
|
||||||
Microsoft.MicrosoftOfficeHub
|
Microsoft Sticky Notes
|
||||||
Microsoft.MicrosoftSolitaireCollection
|
Outlook for Windows
|
||||||
Microsoft.MicrosoftStickyNotes
|
Paint
|
||||||
Microsoft.WindowsCalculator
|
Power Automate
|
||||||
Microsoft.WindowsFeedbackHub
|
Microsoft To Do
|
||||||
Microsoft.WindowsSoundRecorder
|
Widgets Platform Runtime
|
||||||
Microsoft.ZuneMusic
|
Windows Sound Recorder
|
||||||
Microsoft.XboxIdentityProvider
|
Xbox TCUI
|
||||||
Microsoft.ScreenSketch
|
Game Bar
|
||||||
Microsoft.Paint
|
Xbox Identity Provider
|
||||||
Microsoft.StartExperiencesApp
|
Game Speech Window
|
||||||
Microsoft.WidgetsPlatformRuntime
|
Phone Link
|
||||||
Microsoft.Todos
|
Windows Web Experience Pack
|
||||||
Microsoft.PowerAutomateDesktop
|
9MSSGKG348SP
|
||||||
MicrosoftCorporationII.QuickAssist
|
|
||||||
Microsoft.YourPhone
|
|
||||||
Microsoft.XboxSpeechToTextOverlay
|
|
||||||
Microsoft.XboxGamingOverlay
|
|
||||||
Microsoft.Xbox.TCUI
|
|
||||||
396
configwinpc.ps1
396
configwinpc.ps1
@@ -1,9 +1,6 @@
|
|||||||
# https://github.com/andrew-s-taylor/public/blob/main/De-Bloat/RemoveBloat.ps1
|
# https://github.com/andrew-s-taylor/public/blob/main/De-Bloat/RemoveBloat.ps1
|
||||||
# https://github.com/marlock9/edge-debloat/blob/main/edge-debloat.reg
|
# https://github.com/marlock9/edge-debloat/blob/main/edge-debloat.reg
|
||||||
|
|
||||||
## TODO
|
|
||||||
# Taskbar settings, Edge and bloatware for all users
|
|
||||||
|
|
||||||
clear-Host
|
clear-Host
|
||||||
|
|
||||||
# Open PowerShell as administrator
|
# Open PowerShell as administrator
|
||||||
@@ -13,39 +10,20 @@ if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdenti
|
|||||||
}
|
}
|
||||||
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host -ForegroundColor Yellow "### SCRIPT
|
Write-Host -ForegroundColor Yellow "
|
||||||
FOR CONFIGURING
|
|
||||||
AND
|
|
||||||
DEBLOATING
|
|
||||||
WINDOWS 11 ###"
|
|
||||||
|
|
||||||
##########################################################################################
|
######################################################
|
||||||
# #
|
# #
|
||||||
# Execution policy #
|
|
||||||
# #
|
# #
|
||||||
##########################################################################################
|
# SCRIPT FOR CONFIGURING AND DEBLOATING WINDOWS 11 #
|
||||||
|
# #
|
||||||
|
# by dado #
|
||||||
|
######################################################
|
||||||
|
|
||||||
Write-Host ""
|
"
|
||||||
|
|
||||||
# Check the current execution policy
|
|
||||||
$currentPolicy = Get-ExecutionPolicy -Scope LocalMachine
|
|
||||||
|
|
||||||
# Define the desired execution policy
|
|
||||||
$desiredPolicy = "RemoteSigned"
|
|
||||||
|
|
||||||
# If the current policy is not the desired one, change it
|
|
||||||
if ($currentPolicy -ne $desiredPolicy) {
|
|
||||||
# Change the policy (requires admin rights)
|
|
||||||
Set-ExecutionPolicy -ExecutionPolicy $desiredPolicy -Scope LocalMachine -Force | Out-Null
|
|
||||||
|
|
||||||
# Confirm the change
|
|
||||||
Write-Host -ForegroundColor Yellow "Execution policy changed to '$desiredPolicy'."
|
|
||||||
} else {
|
|
||||||
Write-Host -ForegroundColor DarkGreen "Current execution policy is already set to '$currentPolicy'."
|
|
||||||
}
|
|
||||||
|
|
||||||
# Sleep for 5 seconds
|
# Sleep for 5 seconds
|
||||||
Start-Sleep -Seconds 5
|
Start-Sleep -Seconds 10
|
||||||
|
|
||||||
clear-Host
|
clear-Host
|
||||||
|
|
||||||
@@ -59,12 +37,14 @@ clear-Host
|
|||||||
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host -ForegroundColor Yellow ">>> Upgrade packages... <<<"
|
Write-Host -ForegroundColor Yellow ">>> Upgrade packages... <<<"
|
||||||
winget upgrade --all --disable-interactivity
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host -ForegroundColor Yellow ">>> Install default software... <<<"
|
winget upgrade --all
|
||||||
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 ""
|
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 <<<"
|
Write-Host -ForegroundColor DarkGray ">>> Copy 'Supremo' to Public Desktop <<<"
|
||||||
$supremo_path=".\supremo.exe"
|
$supremo_path=".\supremo.exe"
|
||||||
If (Test-Path $supremo_path ) {
|
If (Test-Path $supremo_path ) {
|
||||||
@@ -81,33 +61,70 @@ Write-Host ""
|
|||||||
# Taskbar Adjustment
|
# Taskbar Adjustment
|
||||||
Write-Host -ForegroundColor Yellow ">>> Manage Taskbar <<<"
|
Write-Host -ForegroundColor Yellow ">>> Manage Taskbar <<<"
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|
||||||
|
# Define registry paths for taskbar settings
|
||||||
|
$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"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Set left align
|
||||||
Write-Host -ForegroundColor DarkGray ">>> Set left align <<<"
|
Write-Host -ForegroundColor DarkGray ">>> Set left align <<<"
|
||||||
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarAl" -Value "0" -Type DWORD -Force | Out-Null
|
foreach ($path in $RegistryPaths[0..1]) {
|
||||||
|
New-ItemProperty -Path $path -Name "TaskbarAl" -Value 0 -Type DWORD -Force | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Hide search
|
||||||
Write-Host -ForegroundColor DarkGray ">>> Hide search <<<"
|
Write-Host -ForegroundColor DarkGray ">>> Hide search <<<"
|
||||||
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchBoxTaskbarMode" -Value "0" -Type DWORD -Force | Out-Null
|
Set-ItemProperty -Path $RegistryPaths[2] -Name "SearchBoxTaskbarMode" -Value 0 -Type DWORD -Force | Out-Null
|
||||||
|
|
||||||
|
# Hide TaskView button
|
||||||
Write-Host -ForegroundColor DarkGray ">>> Hide TaskView button <<<"
|
Write-Host -ForegroundColor DarkGray ">>> Hide TaskView button <<<"
|
||||||
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowTaskViewButton" -Value "0" -Type DWORD -Force | Out-Null
|
foreach ($path in $RegistryPaths[0..1]) {
|
||||||
|
Set-ItemProperty -Path $path -Name "ShowTaskViewButton" -Value 0 -Type DWORD -Force | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Disable widgets in the taskbar
|
||||||
Write-Host -ForegroundColor DarkGray ">>> Disable widgets in the taskbar <<<"
|
Write-Host -ForegroundColor DarkGray ">>> Disable widgets in the taskbar <<<"
|
||||||
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarWidgetsEnabled" -Value "0" | Out-Null
|
Set-ItemProperty -Path $RegistryPaths[0] -Name "TaskbarWidgetsEnabled" -Value 0 | Out-Null
|
||||||
|
Set-ItemProperty -Path $RegistryPaths[1] -Name "TaskbarWidgetsEnabled" -Value 0 | Out-Null
|
||||||
|
|
||||||
|
# Disable the 'Windows + W' keyboard shortcut to open widgets
|
||||||
Write-Host -ForegroundColor DarkGray ">>> Disable the 'Windows + W' keyboard shortcut to open widgets <<<"
|
Write-Host -ForegroundColor DarkGray ">>> Disable the 'Windows + W' keyboard shortcut to open widgets <<<"
|
||||||
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "ShowWindowsW" -Value "0" | Out-Null
|
Set-ItemProperty -Path $RegistryPaths[3] -Name "ShowWindowsW" -Value 0 | Out-Null
|
||||||
|
Set-ItemProperty -Path $RegistryPaths[4] -Name "ShowWindowsW" -Value 0 | Out-Null
|
||||||
|
|
||||||
|
# Remove Chat from the Taskbar
|
||||||
Write-Host -ForegroundColor DarkGray ">>> Removes Chat from the Taskbar <<<"
|
Write-Host -ForegroundColor DarkGray ">>> Removes Chat from the Taskbar <<<"
|
||||||
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarMn" -Value "0" -PropertyType DWORD -Force | Out-Null
|
foreach ($path in $RegistryPaths[0..1]) {
|
||||||
|
New-ItemProperty -Path $path -Name "TaskbarMn" -Value 0 -PropertyType DWORD -Force | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Disabling 'Recommended' section
|
||||||
Write-Host -ForegroundColor DarkGray ">>> Disabling 'Recommended' section <<<"
|
Write-Host -ForegroundColor DarkGray ">>> Disabling 'Recommended' section <<<"
|
||||||
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Start_IrisRecommendations" -Value "0" -Type DWORD -Force | Out-Null
|
foreach ($path in $RegistryPaths) {
|
||||||
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Start_TrackDocs" -Value "0" -Type DWORD -Force | Out-Null
|
New-ItemProperty -Path $path -Name "Start_IrisRecommendations" -Value 0 -Type DWORD -Force | Out-Null
|
||||||
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Start_Layout" -Value "1" -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
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|
||||||
$taskbarDa_path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
# Define the registry paths for TaskbarDa
|
||||||
If (Test-Path $taskbarDa_path\TaskbarDa) {
|
$RegistryPaths = @(
|
||||||
Remove-ItemProperty "$taskbarDa_path" -Name "TaskbarDa" -Force | Out-Null
|
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
|
||||||
|
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
||||||
|
)
|
||||||
|
|
||||||
|
# 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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
@@ -119,13 +136,35 @@ If (Test-Path $taskbarDa_path\TaskbarDa) {
|
|||||||
Write-Host -ForegroundColor Yellow ">>> Configure File Explorer <<<"
|
Write-Host -ForegroundColor Yellow ">>> Configure File Explorer <<<"
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host -ForegroundColor DarkGray ">>> Set File Explorer to Open to This PC Instead of Quick Access <<<"
|
Write-Host -ForegroundColor DarkGray ">>> Set File Explorer to Open to This PC Instead of Quick Access <<<"
|
||||||
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "LaunchTo" -Value "1" -Type DWORD -Force | Out-Null
|
|
||||||
|
|
||||||
Write-Host -ForegroundColor DarkGray ">>> Enable Compact View <<<"
|
Write-Host -ForegroundColor DarkGray ">>> Enable Compact View <<<"
|
||||||
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "UseCompactMode" -Value "1" -Force | Out-Null
|
|
||||||
|
|
||||||
Write-Host -ForegroundColor DarkGray ">>> Show file extensions in Explorer <<<"
|
Write-Host -ForegroundColor DarkGray ">>> Show file extensions in Explorer <<<"
|
||||||
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Value "0" -Type DWORD -Force | Out-Null
|
|
||||||
|
# Set the registry paths for both HKLM and HKCU
|
||||||
|
$RegistryPaths = @(
|
||||||
|
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
|
||||||
|
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create a hashtable to store the property names and their corresponding values
|
||||||
|
$ExplorerProperties = @{
|
||||||
|
"LaunchTo" = 1
|
||||||
|
"UseCompactMode" = 1
|
||||||
|
"HideFileExt" = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Iterate over each registry path
|
||||||
|
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 $ExplorerProperties.Keys) {
|
||||||
|
$Value = $ExplorerProperties[$Name]
|
||||||
|
New-ItemProperty -Path $RegistryPath -Name $Name -Value $Value -PropertyType DWORD -Force | Out-Null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
# #
|
# #
|
||||||
@@ -135,26 +174,72 @@ New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer
|
|||||||
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host -ForegroundColor Yellow ">>> Disable Spotlight <<<"
|
Write-Host -ForegroundColor Yellow ">>> Disable Spotlight <<<"
|
||||||
|
|
||||||
Write-Host ""
|
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"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Disable Windows Spotlight on lockscreen
|
||||||
Write-Host -ForegroundColor DarkGray ">>> Disabling Windows Spotlight on lockscreen <<<"
|
Write-Host -ForegroundColor DarkGray ">>> Disabling Windows Spotlight on lockscreen <<<"
|
||||||
$spotlight = "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
|
foreach ($spotlight in $RegistryPaths[0..1]) {
|
||||||
If (Test-Path $spotlight) {
|
If (Test-Path $spotlight) {
|
||||||
Set-ItemProperty $spotlight -Name "RotatingLockScreenOverlayEnabled" -Value "0"
|
Set-ItemProperty -Path $spotlight -Name "RotatingLockScreenOverlayEnabled" -Value 0 -Force | Out-Null
|
||||||
Set-ItemProperty $spotlight -Name "RotatingLockScreenEnabled" -Value "0"
|
Set-ItemProperty -Path $spotlight -Name "RotatingLockScreenEnabled" -Value 0 -Force | Out-Null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Disable Windows Spotlight on background
|
||||||
Write-Host -ForegroundColor DarkGray ">>> Disabling Windows Spotlight on background <<<"
|
Write-Host -ForegroundColor DarkGray ">>> Disabling Windows Spotlight on background <<<"
|
||||||
$spotlight = "HKCU:\Software\Policies\Microsoft\Windows\CloudContent"
|
foreach ($spotlight in $RegistryPaths[2..3]) {
|
||||||
If (Test-Path $spotlight) {
|
If (Test-Path $spotlight) {
|
||||||
Set-ItemProperty $spotlight -Name "DisableSpotlightCollectionOnDesktop" -Value "1"
|
Set-ItemProperty -Path $spotlight -Name "DisableSpotlightCollectionOnDesktop" -Value 1 -Force | Out-Null
|
||||||
Set-ItemProperty $spotlight -Name "DisableWindowsSpotlightFeatures" -Value "1"
|
Set-ItemProperty -Path $spotlight -Name "DisableWindowsSpotlightFeatures" -Value 1 -Force | Out-Null
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# #
|
||||||
|
# Lock Screen Notifications #
|
||||||
|
# #
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host -ForegroundColor Yellow ">>> Disable Notifications on Lock Screen <<<"
|
Write-Host -ForegroundColor Yellow ">>> Disable Notifications on Lock Screen <<<"
|
||||||
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings" -Name "NOC_GLOBAL_SETTING_ALLOW_TOASTS_ABOVE_LOCK" -Value "0" -Type DWORD -Force | Out-Null
|
|
||||||
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications" -Name "LockScreenToastEnabled" -Value "0" -Type DWORD -Force | Out-Null
|
# Set the registry paths for notifications settings
|
||||||
|
$RegistryPaths = @(
|
||||||
|
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings",
|
||||||
|
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings",
|
||||||
|
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications"
|
||||||
|
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create a hashtable to store the property names and their corresponding values
|
||||||
|
$NotificationProperties = @{
|
||||||
|
"NOC_GLOBAL_SETTING_ALLOW_TOASTS_ABOVE_LOCK" = 0
|
||||||
|
"LockScreenToastEnabled" = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Iterate over each registry path
|
||||||
|
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 $NotificationProperties.Keys) {
|
||||||
|
$Value = $NotificationProperties[$Name]
|
||||||
|
New-ItemProperty -Path $RegistryPath -Name $Name -Value $Value -PropertyType DWORD -Force | Out-Null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host ""
|
||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
# #
|
# #
|
||||||
@@ -162,12 +247,45 @@ New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNoti
|
|||||||
# #
|
# #
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
|
|
||||||
|
Write-Host -ForegroundColor Yellow ">>> Change Control Panel View <<<"
|
||||||
|
|
||||||
|
# Set the registry paths for both HKLM and HKCU
|
||||||
|
$RegistryPaths = @(
|
||||||
|
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel",
|
||||||
|
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create a hashtable to store the property names and their corresponding values
|
||||||
|
$ControlPanelProperties = @{
|
||||||
|
"AllItemsIconView" = 1
|
||||||
|
"StartupPage" = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Iterate over each registry path
|
||||||
|
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 $ControlPanelProperties.Keys) {
|
||||||
|
$Value = $ControlPanelProperties[$Name]
|
||||||
|
New-ItemProperty -Path $RegistryPath -Name $Name -Value $Value -PropertyType DWORD -Force | Out-Null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host -ForegroundColor DarkGray ">>> Change Control Panel View <<<"
|
|
||||||
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" -Name "AllItemsIconView" -Value "1" -Type DWORD -Force | Out-Null
|
##########################################################################################
|
||||||
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" -Name "StartupPage" -Value "1" -Type DWORD -Force | Out-Null
|
# #
|
||||||
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" -Name "AllItemsIconView" -Value "1" -Type DWORD -Force | Out-Null
|
# Welcome Experience #
|
||||||
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" -Name "StartupPage" -Value "1" -Type DWORD -Force | Out-Null
|
# #
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
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 ""
|
Write-Host ""
|
||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
@@ -177,16 +295,50 @@ Write-Host ""
|
|||||||
##########################################################################################
|
##########################################################################################
|
||||||
|
|
||||||
Write-Host -ForegroundColor Yellow ">>> Disable Microsoft Edge First Run Welcome Page <<<"
|
Write-Host -ForegroundColor Yellow ">>> Disable Microsoft Edge First Run Welcome Page <<<"
|
||||||
# Set variables to indicate value and key to set
|
|
||||||
$RegistryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Edge"
|
# Set the registry paths for both HKLM and HKCU
|
||||||
$Name = "HideFirstRunExperience"
|
$RegistryPaths = @(
|
||||||
$Value = "1"
|
"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
|
||||||
|
"CopilotPageContext" = 0
|
||||||
|
"Microsoft365CopilotChatIconEnabled" = 0
|
||||||
|
"NewTabPageContentEnabled" = 0
|
||||||
|
"NewTabPageBingChatEnabled" = 0
|
||||||
|
"NewTabPageAppLauncherEnabled" = 0
|
||||||
|
"UserFeedbackAllowed" = 0
|
||||||
|
"PersonalizationReportingEnabled" = 0
|
||||||
|
"PersonalizeTopSitesInCustomizeSidebarEnabled" = 0
|
||||||
|
"EdgeCollectionsEnabled" = 0
|
||||||
|
"ShowMicrosoftRewards" = 0
|
||||||
|
"ShowAcrobatSubscriptionButton" = 0
|
||||||
|
"DefaultBrowserSettingsCampaignEnabled" = 0
|
||||||
|
"EdgeShoppingAssistantEnabled" = 0
|
||||||
|
"VisualSearchEnabled" = 0
|
||||||
|
"NewTabPageAllowedBackgroundTypes" = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
# Iterate over each registry path
|
||||||
|
foreach ($RegistryPath in $RegistryPaths) {
|
||||||
# Create the key if it does not exist
|
# Create the key if it does not exist
|
||||||
If (-NOT (Test-Path $RegistryPath)) {
|
If (-NOT (Test-Path $RegistryPath)) {
|
||||||
New-Item -Path $RegistryPath -Force | Out-Null
|
New-Item -Path $RegistryPath -Force | Out-Null
|
||||||
}
|
}
|
||||||
# Now set the value
|
|
||||||
|
# Set the values based on the hashtable
|
||||||
|
foreach ($Name in $EdgeProperties.Keys) {
|
||||||
|
$Value = $EdgeProperties[$Name]
|
||||||
New-ItemProperty -Path $RegistryPath -Name $Name -Value $Value -PropertyType DWORD -Force | Out-Null
|
New-ItemProperty -Path $RegistryPath -Name $Name -Value $Value -PropertyType DWORD -Force | Out-Null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
@@ -195,30 +347,28 @@ Write-Host ""
|
|||||||
# #
|
# #
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
|
|
||||||
# Export the registry keys
|
## Export the registry keys
|
||||||
Write-Host -ForegroundColor DarkGray ">>> Exporting registry settings... <<<"
|
#Write-Host -ForegroundColor DarkGray ">>> Exporting registry settings... <<<"
|
||||||
|
#
|
||||||
# Create a temporary folder for export
|
## Create a temporary folder for export
|
||||||
$exportPath = "C:\temp"
|
#$exportPath = "C:\temp"
|
||||||
if (-Not (Test-Path $exportPath)) {
|
#if (-Not (Test-Path $exportPath)) {
|
||||||
New-Item -ItemType Directory -Path $exportPath | Out-Null
|
# New-Item -ItemType Directory -Path $exportPath | Out-Null
|
||||||
}
|
#}
|
||||||
|
#
|
||||||
reg export "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "$exportPath\TaskbarSettings.reg" /y | 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
|
#reg export "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" "$exportPath\SearchSettings.reg" /y | Out-Null
|
||||||
|
#
|
||||||
Write-Host -ForegroundColor DarkGray ">>> Importing registry settings to Default Profile <<<"
|
#Write-Host -ForegroundColor DarkGray ">>> Importing registry settings to Default Profile <<<"
|
||||||
|
#
|
||||||
# Copy the registry files to the default profile
|
## Copy the registry files to the default profile
|
||||||
Copy-Item "$exportPath\TaskbarSettings.reg" "C:\Users\Default\Desktop"
|
#Copy-Item "$exportPath\TaskbarSettings.reg" "C:\Users\Default\Desktop"
|
||||||
Copy-Item "$exportPath\SearchSettings.reg" "C:\Users\Default\Desktop"
|
#Copy-Item "$exportPath\SearchSettings.reg" "C:\Users\Default\Desktop"
|
||||||
|
#
|
||||||
# Remove the temporary folder
|
## Remove the temporary folder
|
||||||
Remove-Item -Path $exportPath -Recurse -Force
|
#Remove-Item -Path $exportPath -Recurse -Force
|
||||||
|
#
|
||||||
Write-Host -ForegroundColor DarkGray ">>> Unpin Microsoft Store <<<"
|
#Write-Host ""
|
||||||
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq "Microsoft Store"}).Verbs() | ?{$_.Name.replace('&','') -match 'Unpin from taskbar'} | %{$_.DoIt(); $exec = $true}
|
|
||||||
Write-Host ""
|
|
||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
# #
|
# #
|
||||||
@@ -265,7 +415,7 @@ Write-Host ""
|
|||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
# #
|
# #
|
||||||
# Windows Update #
|
# Windows Update Setting #
|
||||||
# #
|
# #
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
|
|
||||||
@@ -273,11 +423,6 @@ Write-Host -ForegroundColor Yellow ">>> Windows Update settings <<<"
|
|||||||
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host -ForegroundColor DarkGray ">>> Enable 'Get updates for other Microsoft products' <<<"
|
Write-Host -ForegroundColor DarkGray ">>> Enable 'Get updates for other Microsoft products' <<<"
|
||||||
# Check if the script is running as administrator
|
|
||||||
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
|
||||||
Write-Error -ForegroundColor Red "This script must be run with administrator privileges."
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$UpdateServiceManager = New-Object -ComObject "Microsoft.Update.ServiceManager"
|
$UpdateServiceManager = New-Object -ComObject "Microsoft.Update.ServiceManager"
|
||||||
@@ -287,6 +432,10 @@ try {
|
|||||||
catch {
|
catch {
|
||||||
Write-Error "An error occurred while configuring Microsoft Update: $($_.Exception.Message)"
|
Write-Error "An error occurred while configuring Microsoft Update: $($_.Exception.Message)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
####################################################################################################################################
|
||||||
|
|
||||||
|
|
||||||
Write-Host -ForegroundColor DarkGray ">>> Set the notification behavior for updates to 'Do not show any notifications (excluding restart notifications)' <<<"
|
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"
|
$RegistryPath = "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings"
|
||||||
$RegistryName = "ConfigureNotificationsForWU"
|
$RegistryName = "ConfigureNotificationsForWU"
|
||||||
@@ -298,12 +447,6 @@ $RegistryValue = 0 # Do not show any notifications (excluding restart notificat
|
|||||||
# 2: Notify for download and installation
|
# 2: Notify for download and installation
|
||||||
# 3: Disable all notifications
|
# 3: Disable all notifications
|
||||||
|
|
||||||
# Check if the script is running as administrator
|
|
||||||
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
|
||||||
Write-Error -ForegroundColor Red "This script must be run with administrator privileges."
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
# Check if the registry path exists
|
# Check if the registry path exists
|
||||||
if (-not (Test-Path -Path $RegistryPath)) {
|
if (-not (Test-Path -Path $RegistryPath)) {
|
||||||
@@ -319,12 +462,12 @@ catch {
|
|||||||
Write-Error "An error occurred while modifying the registry: $($_.Exception.Message)"
|
Write-Error "An error occurred while modifying the registry: $($_.Exception.Message)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
####################################################################################################################################
|
||||||
|
|
||||||
# Set "Do not restart if user is logged on"
|
# Set "Do not restart if user is logged on"
|
||||||
Write-Host -ForegroundColor DarkGray ">>> 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
|
# Define the value to disable automatic reboots when a user is logged on
|
||||||
$NoAutoRebootWithLoggedOnUsers = 1
|
$NoAutoRebootWithLoggedOnUsers = 1
|
||||||
# Registry path for Windows Update
|
|
||||||
$WindowsUpdateRegistryPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update"
|
$WindowsUpdateRegistryPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update"
|
||||||
|
|
||||||
# Check if the registry key exists, otherwise create it
|
# Check if the registry key exists, otherwise create it
|
||||||
@@ -335,8 +478,7 @@ if (!(Test-Path $WindowsUpdateRegistryPath)) {
|
|||||||
# Set the NoAutoRebootWithLoggedOnUsers value
|
# Set the NoAutoRebootWithLoggedOnUsers value
|
||||||
Set-ItemProperty -Path $WindowsUpdateRegistryPath -Name "NoAutoRebootWithLoggedOnUsers" -Value $NoAutoRebootWithLoggedOnUsers -Type DWORD | Out-Null
|
Set-ItemProperty -Path $WindowsUpdateRegistryPath -Name "NoAutoRebootWithLoggedOnUsers" -Value $NoAutoRebootWithLoggedOnUsers -Type DWORD | Out-Null
|
||||||
|
|
||||||
# Check if the setting has been applied correctly
|
####################################################################################################################################
|
||||||
$CheckValue = Get-ItemProperty -Path $WindowsUpdateRegistryPath -Name "NoAutoRebootWithLoggedOnUsers"
|
|
||||||
|
|
||||||
# Restart the Windows Update service to apply the change immediately
|
# Restart the Windows Update service to apply the change immediately
|
||||||
Restart-Service -Name "wuauserv" -Force | Out-Null
|
Restart-Service -Name "wuauserv" -Force | Out-Null
|
||||||
@@ -345,6 +487,12 @@ Restart-Service -Name "wuauserv" -Force | Out-Null
|
|||||||
taskkill /f /im explorer.exe | Out-Null
|
taskkill /f /im explorer.exe | Out-Null
|
||||||
start explorer.exe | Out-Null
|
start explorer.exe | Out-Null
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# #
|
||||||
|
# Available Updates #
|
||||||
|
# #
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
# Checking for Available Updates
|
# Checking for Available Updates
|
||||||
Install-Module -Name PSWindowsUpdate -Force -Confirm:$False
|
Install-Module -Name PSWindowsUpdate -Force -Confirm:$False
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
@@ -354,7 +502,7 @@ Write-Host ""
|
|||||||
|
|
||||||
# Installing Windows Updates
|
# Installing Windows Updates
|
||||||
Write-Host -ForegroundColor Yellow ">>> Installing Windows Updates... <<<"
|
Write-Host -ForegroundColor Yellow ">>> Installing Windows Updates... <<<"
|
||||||
Install-WindowsUpdate -AcceptAll
|
Install-WindowsUpdate -AcceptAll -Force -Verbose -NoReboot
|
||||||
|
|
||||||
# Monitoring Update Installation
|
# Monitoring Update Installation
|
||||||
# Write-Host ""
|
# Write-Host ""
|
||||||
@@ -370,13 +518,16 @@ Write-Host ""
|
|||||||
Write-Host -ForegroundColor Yellow ">>> Starting the process to remove unnecessary bloatware applications... <<<"
|
Write-Host -ForegroundColor Yellow ">>> Starting the process to remove unnecessary bloatware applications... <<<"
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|
||||||
# Read the content of the bloatware-list.txt file
|
# Get the directory of the currently executing script
|
||||||
$appsToRemove = Get-Content (Join-Path $env:USERPROFILE "Desktop\bloatware-list.txt")
|
$scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
|
|
||||||
|
# Construct the path to the bloatware-apps.txt file
|
||||||
|
$appsToRemove = Get-Content (Join-Path $scriptDirectory "bloatware-apps.txt")
|
||||||
|
|
||||||
# Remove the specified apps from the list
|
# Remove the specified apps from the list
|
||||||
foreach ($app in $appsToRemove) {
|
foreach ($app in $appsToRemove) {
|
||||||
try {
|
try {
|
||||||
Get-AppxPackage -Name $app | Remove-AppxPackage -AllUsers -ErrorAction Stop
|
winget uninstall --name $app
|
||||||
Write-Host "Removed: $app"
|
Write-Host "Removed: $app"
|
||||||
} catch {
|
} catch {
|
||||||
Write-Host "Error removing: $app. Details: $_"
|
Write-Host "Error removing: $app. Details: $_"
|
||||||
@@ -387,9 +538,22 @@ Write-Host -ForegroundColor Yellow ">>> Uninstallation of Microsoft Office <<<"
|
|||||||
Start-Process "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" "https://aka.ms/SaRA-officeUninstallFromPC"
|
Start-Process "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" "https://aka.ms/SaRA-officeUninstallFromPC"
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|
||||||
# Write-Host -ForegroundColor Yellow ">>> Retrieving the list of installed Win32 programs... <<<"
|
# >>>>>> https://pureinfotech.com/windows-11-policy-remove-bloatware/ <<<<<<
|
||||||
# List of Win32 programs
|
Write-Host -ForegroundColor Yellow ">>> From Windows 24H2, enable the policy "
|
||||||
# Get-WmiObject -Class Win32_Product | Select-Object -Property Name
|
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 ""
|
||||||
|
|
||||||
|
# Sleep for 30 seconds
|
||||||
|
Start-Sleep -Seconds 60
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# #
|
||||||
|
# End #
|
||||||
|
# #
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
# Show the message
|
# Show the message
|
||||||
Write-Host -ForegroundColor Cyan ">>> Press any key to continue... <<<"
|
Write-Host -ForegroundColor Cyan ">>> Press any key to continue... <<<"
|
||||||
|
|||||||
Reference in New Issue
Block a user