Skip to content

Instantly share code, notes, and snippets.

@QNimbus
Last active March 20, 2025 20:49
Show Gist options
  • Save QNimbus/a637b1507b8ba07ede2e52d6ca50e3ac to your computer and use it in GitHub Desktop.
Save QNimbus/a637b1507b8ba07ede2e52d6ca50e3ac to your computer and use it in GitHub Desktop.
Windows deployment & provisioning #windows
Office 365 config.xml
Windows Sandbox config.wsb
Windows-Installer.ps1
boxstarter-sandbox.ps1
boxstarter-win11.ps1
# Title: Windows 11 Deployment Script
# Author: B. van Wetten
# Description: Deployment script for Boxstarter and removing bloatware
# Last Update: 2023-03-14
#
# Deploy: pwsh.exe -ExecutionPolicy Unrestricted -Command { Invoke-WebRequest -OutFile "$env:USERPROFILE\OneDrive\Documents\Windows Sandbox config.wsb" -Uri 'https://gist.githubusercontent.com/QNimbus/a637b1507b8ba07ede2e52d6ca50e3ac/raw/75e438815ea9f4daf3ea49ac1e87c2e4f0d6d394/Windows%20Sandbox%20config.wsb' }
#
# Usage: Install-BoxstarterPackage -PackageName <GIST URL> -DisableReboots
[System.Console]::SetWindowPosition(0,[System.Console]::CursorTop)
Set-WindowsExplorerOptions -EnableShowFileExtensions
#
# Install packages
#
# Brave
cinst -y brave
cinst -y nordvpn
# Setting up user profile
Remove-Item "$env:PUBLIC\Desktop\*.lnk" -ErrorAction SilentlyContinue
Remove-Item "$env:USERPROFILE\Desktop\*.lnk" -ErrorAction SilentlyContinue
# Title: Windows 11 Deployment Script
# Author: B. van Wetten
# Description: Deployment script for Boxstarter and removing bloatware
# Last Update: 2023-03-14
#
# Usage: Install-BoxstarterPackage -DisableReboots -PackageName <URL or SCRIPT>
#
# or: . { iwr -useb https://boxstarter.org/bootstrapper.ps1 } | iex; Get-Boxstarter -Force
# Install-BoxstarterPackage -DisableReboots -PackageName <URL or SCRIPT>
Set-Variable -Name ProgressPreference -Value "SilentlyContinue"
# Boxstarter options
$Boxstarter.RebootOk=$false # Allow reboots?
$Boxstarter.NoPassword=$false # Is this a machine with no login password?
$Boxstarter.AutoLogin=$false # Save my password securely and auto-login after a reboot
# All of the configuration tasks that will be run.
$Configuration = @(
"DisableTelemetry"
"DisableWebSearch"
"DisableMapUpdates"
"DisableEdgeHubSidebar"
"DisableSSHAgent"
"HideTaskbarSearchBox"
"HideChatIcon"
"HideMicrosoftStore"
"DisableKillerNetworkServices"
);
$bloatwareList = @(
"MicrosoftTeams"
"Microsoft.WindowsAlarms"
"Microsoft.windowscommunicationsapps"
"Microsoft.Todos"
"Microsoft.BingFinance"
"Microsoft.3DBuilder"
"Microsoft.BingNews"
"Microsoft.BingSports"
"Microsoft.BingWeather"
"Microsoft.CommsPhone"
"Microsoft.Getstarted"
"Microsoft.WindowsMaps"
"*MarchofEmpires*"
"Microsoft.GetHelp"
"Microsoft.Messaging"
"*Minecraft*"
"Microsoft.Office.*"
"Microsoft.MicrosoftOfficeHub"
"Microsoft.OneConnect"
"Microsoft.WindowsPhone"
"Microsoft.WindowsSoundRecorder"
"*Solitaire*"
"Microsoft.MicrosoftStickyNotes"
"Microsoft.Office.Sway"
"Microsoft.XboxApp"
"Microsoft.XboxIdentityProvider"
"Microsoft.XboxGameOverlay"
"Microsoft.XboxGamingOverlay"
"Microsoft.ZuneMusic"
"Microsoft.ZuneVideo"
"Microsoft.NetworkSpeedTest"
"Microsoft.FreshPaint"
"Microsoft.Print3D"
"Microsoft.People*"
"Microsoft.Microsoft3DViewer"
"Microsoft.MixedReality.Portal*"
"*Skype*"
"*Autodesk*"
"*BubbleWitch*"
"king.com*"
"G5*"
"*Dell*"
"*Facebook*"
"*Keeper*"
"*Netflix*"
"*Twitter*"
"*Plex*"
);
$applicationList = @(
"vscode"
"evernote"
"spotify"
"firefox"
"nvidia-display-driver"
"directoryopus --ignore-checksums"
);
$enabledWindowsFeatures = @(
"OpenSSH.Client~~~~0.0.1.0"
"OpenSSH.Server~~~~0.0.1.0"
);
function Deploy() {
# Check to make sure script is run as administrator
Write-Host "[+] Checking if script is running as administrator..." -ForegroundColor Green
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal( [Security.Principal.WindowsIdentity]::GetCurrent() )
if (-Not $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host "[-] Please run this script as administrator`n" -ForegroundColor Red
Read-Host "Press any key to continue"
exit
}
# From a Administrator PowerShell, if Get-ExecutionPolicy returns Restricted, run:
if ((Get-ExecutionPolicy) -eq "Restricted") {
Write-Host "[+] Setting ExecutionPolicy to 'Unrestricted'" -ForegroundColor Green
Set-ExecutionPolicy Unrestricted -Force
}
# Set environment to run this script
Disable-UAC
#
# Remove bloatware
#
Write-Host "[+] Removing bloatware" -ForegroundColor Green
$rbw = Remove-Bloatware
if ( -Not $rbw ) {
Write-Host "[-] Failed to remove bloatware" -ForegroundColor Red
}
#
# Enable windows features
#
Write-Host "[+] Enabling windows features" -ForegroundColor Green
$ewf = Enable-Windows-Features
if ( -Not $ewf ) {
Write-Host "[-] Failed to enable windows features" -ForegroundColor Red
}
#
# Configure windows
#
Write-Host "[+] Configuring Windows" -ForegroundColor Green
$cfw = Configure-Windows
if ( -Not $cfw ) {
Write-Host "[-] Failed to configure Windows" -ForegroundColor Red
}
#
# Install chocolatey packages
#
Write-Host "[+] Installing chocolatey packages" -ForegroundColor Green
$icp = Install-Chocolatey-Packages
if ( -Not $icp ) {
Write-Host "[-] Failed to install Chocolatey packages" -ForegroundColor Red
}
# Setting up user profile
Remove-Item "$env:PUBLIC\Desktop\*.lnk" -ErrorAction SilentlyContinue
Remove-Item "$env:USERPROFILE\Desktop\*.lnk" -ErrorAction SilentlyContinue
Remove-Item "$env:ProgramData\Microsoft\Windows\Start Menu\Programs\*.lnk" -ErrorAction SilentlyContinue
Remove-Item "$env:ProgramData\Microsoft\Windows\Start Menu\Programs\Boxstarter" -ErrorAction SilentlyContinue
Remove-Item "$env:ProgramData\Microsoft\Windows\Start Menu\Programs\GPSoftware" -ErrorAction SilentlyContinue
Remove-Item "$env:ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio Code" -ErrorAction SilentlyContinue
#
# Remove-Item "$env:USERPROFILE\Desktop\Brave.lnk" -ErrorAction SilentlyContinue
# Remove-Item "$env:USERPROFILE\Desktop\Microsoft Edge.lnk" -ErrorAction SilentlyContinue
# Remove-Item "$env:PUBLIC\Desktop\Microsoft Edge.lnk" -ErrorAction SilentlyContinue
# Remove-Item "$env:PUBLIC\Desktop\Evernote.lnk" -ErrorAction SilentlyContinue
# Remove-Item "$env:PUBLIC\Desktop\Boxstarter Shell.lnk" -ErrorAction SilentlyContinue
# Remove-Item "$env:PUBLIC\Desktop\Visual Studio Code.lnk" -ErrorAction SilentlyContinue
#
#--- Restore Temporary Settings ---
Enable-UAC
Enable-MicrosoftUpdate
Install-WindowsUpdate -acceptEula -GetUpdatesFromMS
}
function Enable-Windows-Features() {
try {
foreach ($feature in $enabledWindowsFeatures) {
If ((Get-WindowsCapability -Online -Name $feature).State -ne 'Installed') {
Write-Host "[+] Attempting to install feature '$feature'" -ForegroundColor Green
Add-WindowsCapability -Online -Name $feature
} else {
Write-Host "[+] Feature '$feature' already installed" -ForegroundColor Green
}
}
return $true
} catch {
return $false
}
}
function Configure-Windows() {
try {
Disable-BingSearch -ErrorAction SilentlyContinue
Disable-GameBarTips -ErrorAction SilentlyContinue
Set-WindowsExplorerOptions -EnableShowFileExtensions
if ($Configuration.count -gt 0) {
# $RunTweaks = Read-Choice -Message "Continue with the execution of $($Configuration.count) system configuration tweaks?" -Choices @('&Yes','&No')
# if ($RunTweaks -eq 0) {
# # Call the desired tweak functions
# $Configuration | ForEach-Object {
# Invoke-Expression $_
# }
# }
$Configuration | ForEach-Object {
Invoke-Expression $_
}
}
return $true
} catch {
return $false
}
}
function Install-Chocolatey-Packages() {
try {
foreach ($app in $applicationList) {
Write-Output "[+] Attempting to install $app" -ForegroundColor Green
choco install --confirm $app
}
# $jobs = @()
# foreach ($app in $applicationList) {
# $jobs += Start-Job -Name $app -ScriptBlock {
# $params = $using:app
# Write-Output "[+] Attempting to install $params" -ForegroundColor Green
# choco install --confirm $params
# }
# }
# foreach ($job in $jobs) {
# Wait-Job -Job $job
# Receive-Job -Job $job
# Remove-Job -Job $job
# }
# Write-Host "[+] Install finished $params" -ForegroundColor Green
return $true
} catch {
return $false
}
}
function Remove-Bloatware() {
try {
foreach ($app in $bloatwareList) {
Write-Host "[+] Attempting to remove $app" -ForegroundColor Green
Remove-App $app
}
return $true
} catch {
return $false
}
}
function Remove-App() {
Param ([string]$appName)
Get-AppxPackage $appName -AllUsers | Remove-AppxPackage
Get-AppXProvisionedPackage -Online | Where DisplayName -like $appName | Remove-AppxProvisionedPackage -Online
}
function Read-Choice {
Param(
[Parameter(Position = 0)]
[System.String]$Message,
[Parameter(Position = 1)]
[ValidateNotNullOrEmpty()]
[System.String[]]$Choices = @('&Yes', '&No', 'Yes to &All', 'No &to All'),
[Parameter(Position = 2)]
[System.Int32]$DefaultChoice = 0,
[Parameter(Position = 3)]
[System.String]$Title = [string]::Empty
)
[System.Management.Automation.Host.ChoiceDescription[]]$Poss = $Choices | ForEach-Object {
New-Object System.Management.Automation.Host.ChoiceDescription "$($_)", "Sets $_ as an answer."
}
$Host.UI.PromptForChoice( $Title, $Message, $Poss, $DefaultChoice )
}
###
### Functions
###
# Disable Telemetry
Function DisableTelemetry {
Write-Host "[+] Disabling Telemetry..." -ForegroundColor Yellow
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
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "Microsoft Compatibility Appraiser" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "ProgramDataUpdater" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Autochk\" -TaskName "Proxy" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "Consolidator" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "UsbCeip" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\DiskDiagnostic\" -TaskName "Microsoft-Windows-DiskDiagnosticDataCollector" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
}
# Enable Telemetry
Function EnableTelemetry {
Write-Host "[+] Enabling Telemetry..." -ForegroundColor Yellow
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 3
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 3
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 3
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "Microsoft Compatibility Appraiser" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "ProgramDataUpdater" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Autochk\" -TaskName "Proxy" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "Consolidator" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "UsbCeip" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\DiskDiagnostic\" -TaskName "Microsoft-Windows-DiskDiagnosticDataCollector" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
}
# Disable Web Search in Start Menu
Function DisableWebSearch {
Write-Host "[+] Disabling Bing Search in Start Menu..." -ForegroundColor Yellow
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
}
# Enable Web Search in Start Menu
Function EnableWebSearch {
Write-Host "[+] Enabling Bing Search in Start Menu..." -ForegroundColor Yellow
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "DisableWebSearch" -ErrorAction SilentlyContinue
}
# Disable Edge HubSidebar
Function DisableEdgeHubSidebar {
Write-Host "[+] Disabling Edge Hub Sidebar..." -ForegroundColor Yellow
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Edge")) {
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Edge" -Force | Out-Null
}
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Edge" -Name "HubsSidebarEnabled" -Type DWord -Value 0
}
# Enable Edge HubSidebar
Function EnableEdgeHubSidebar {
Write-Host "[+] Enabling Edge Hub Sidebar..." -ForegroundColor Yellow
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Edge")) {
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Edge" -Force | Out-Null
}
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Edge" -Name "HubsSidebarEnabled" -Type DWord -Value 1
}
# Disable automatic Maps updates
Function DisableMapUpdates {
Write-Host "[+] Disabling automatic Maps updates..." -ForegroundColor Yellow
Set-ItemProperty -Path "HKLM:\SYSTEM\Maps" -Name "AutoUpdateEnabled" -Type DWord -Value 0
}
# Enable automatic Maps updates
Function EnableMapUpdates {
Write-Host "[+] Enabling automatic Maps updates..." -ForegroundColor Yellow
Remove-ItemProperty -Path "HKLM:\SYSTEM\Maps" -Name "AutoUpdateEnabled" -ErrorAction SilentlyContinue
}
# Enable OpenSSH Authentication Agent
Function EnableSSHAgent {
Write-Host "[+] Enabling and starting OpenSSH Authentication Agent..." -ForegroundColor Yellow
Set-Service "ssh-agent" -StartupType Automatic
Start-Service "ssh-agent" -WarningAction SilentlyContinue
}
# Disable OpenSSH Authentication Agent
Function DisableSSHAgent {
Write-Host "[+] Disabling and stopping OpenSSH Authentication Agent..." -ForegroundColor Yellow
Stop-Service "ssh-agent" -WarningAction SilentlyContinue
Set-Service "ssh-agent" -StartupType Disabled
}
# Enable Killer Network Services
Function EnableKillerNetworkServices {
Write-Host "[+] Enabling and starting Killer Network Services..." -ForegroundColor Yellow
Set-Service "KAPSService" -StartupType Manual
Set-Service "Killer Analytics Service" -StartupType Automatic
Set-Service "Killer Network Service" -StartupType Automatic
Set-Service "KNDBWM" -StartupType Manual
Start-Service "Killer Analytics Service" -WarningAction SilentlyContinue
Start-Service "Killer Network Service" -WarningAction SilentlyContinue
}
# Disable Killer Network Services
Function DisableKillerNetworkServices {
Write-Host "[+] Disabling and stopping Killer Network Services..." -ForegroundColor Yellow
Stop-Service "KAPSService" -WarningAction SilentlyContinue
Stop-Service "Killer Analytics Service" -WarningAction SilentlyContinue
Stop-Service "Killer Network Service" -WarningAction SilentlyContinue
Stop-Service "KNDBWM" -WarningAction SilentlyContinue
Set-Service "KAPSService" -StartupType Disabled
Set-Service "Killer Analytics Service" -StartupType Disabled
Set-Service "Killer Network Service" -StartupType Disabled
Set-Service "KNDBWM" -StartupType Disabled
}
# Hide taskbar Microsoft Store
Function HideMicrosoftStore {
Write-Host "[+] Hiding taskbar Microsof Store icon..." -ForegroundColor Yellow
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore")) {
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore" -Force | Out-Null
}
If (!(Test-Path "HKCU:\SOFTWARE\Policies\Microsoft\WindowsStore")) {
New-Item -Path "HKCU:\SOFTWARE\Policies\Microsoft\WindowsStore" -Force | Out-Null
}
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore" -Name "RemoveWindowsStore" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\WindowsStore" -Name "RemoveWindowsStore" -Type DWord -Value 1
}
# Show taskbar Microsoft Store
Function ShowMicrosoftStore {
Write-Host "[+] Showing taskbar Microsof Store icon..." -ForegroundColor Yellow
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore" -Name "RemoveWindowsStore" -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\WindowsStore" -Name "RemoveWindowsStore" -ErrorAction SilentlyContinue
}
# Hide chat icon
Function HideChatIcon {
Write-Host "[+] Hiding taskbar Chat icon..." -ForegroundColor Yellow
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarMn" -Type DWord -Value 0
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows" -Name "ChatIcon" -Type DWord -Value 0x03
}
# Show chat icon
Function ShowChatIcon {
Write-Host "[+] Showing taskbar Chat icon..." -ForegroundColor Yellow
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarMn" -Type DWord -Value 1
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows" -Name "ChatIcon" -ErrorAction SilentlyContinue
}
# Hide Taskbar Search button / box
Function HideTaskbarSearchBox {
Write-Host "[+] Hiding Taskbar Search box / button..." -ForegroundColor Yellow
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 0
}
# Show Taskbar Search button / box
Function ShowTaskbarSearchIcon {
Write-Host "[+] Showing Taskbar Search box / button..." -ForegroundColor Yellow
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 1
}
Function ShowTaskbarSearchBox {
Write-Host "[+] Showing Taskbar Search box / button..." -ForegroundColor Yellow
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 2
}
# [System.Console]::SetWindowPosition(0,[System.Console]::CursorTop)
Start-Transcript
Write-Host "[+] Starting configuration and installation" -ForegroundColor Green
Deploy
# [System.Console]::SetWindowPosition(0,[System.Console]::CursorTop)
Write-Host "[+] Configuration and installation complete" -ForegroundColor Green
Stop-Transcript
<Configuration ID="9d035322-d7f0-4d3a-ab54-e0997693d9ea">
<Info Description="" />
<Add OfficeClientEdition="64" Channel="Monthly">
<Product ID="O365HomePremRetail">
<Language ID="en-us" />
<Language ID="nl-nl" />
<ExcludeApp ID="Access" />
<ExcludeApp ID="Groove" />
<ExcludeApp ID="InfoPath" />
<ExcludeApp ID="Lync" />
<ExcludeApp ID="OneNote" />
<ExcludeApp ID="Outlook" />
<ExcludeApp ID="Publisher" />
<ExcludeApp ID="PowerPoint" />
<ExcludeApp ID="SharePointDesigner" />
</Product>
<Product ID="ProofingTools">
<Language ID="nl-nl" />
</Product>
</Add>
<Updates Enabled="TRUE" />
<RemoveMSI />
<Display Level="None" AcceptEULA="TRUE" />
</Configuration>
# Title: Windows 11 Sandbox deployment script - Android Studio
# Author: B. van Wetten
# Description: Deployment script Windows Sandbox
# Last Update: 2023-08-20
# Usage: powershell -Command { Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-WebRequest -UseBasicParsing -Uri 'https://gist.githubusercontent.com/QNimbus/a637b1507b8ba07ede2e52d6ca50e3ac/raw/60c0e11a4f14ca81cb9d6fdce601f36205717c06/Windows%2011%20Sandbox%20deployment%20script%20-%20Android%20Studio.ps1' | Select-Object -ExpandProperty Content | Invoke-Expression }
# Example config 'Windows Sandbox config.wsb'
#
# <Configuration>
# <LogonCommand>
# <Command>powershell -executionpolicy Unrestricted -Command "start powershell { -Command \"Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-WebRequest -UseBasicParsing -Uri 'https://gist.githubusercontent.com/QNimbus/a637b1507b8ba07ede2e52d6ca50e3ac/raw/60c0e11a4f14ca81cb9d6fdce601f36205717c06/Windows%2011%20Sandbox%20deployment%20script%20-%20Android%20Studio.ps1' | Select-Object -ExpandProperty Content | Invoke-Expression \"}"</Command>
# </LogonCommand>
# </Configuration>
class Utils {
# Properties, if any
# Constructor, if required
<#
.SYNOPSIS
Sets a value in the Windows registry.
.DESCRIPTION
This method sets a specified value for a given registry key and name.
It will create the key if it doesn't exist.
.PARAMETER KeyPath
The path to the registry key.
.PARAMETER Name
The name of the registry value to set.
.PARAMETER Value
The data to set for the specified registry value.
.PARAMETER Type
The type of the registry value. Valid options include 'String', 'ExpandString',
'Binary', 'DWord', 'MultiString', 'QWord', and 'None'. Default is 'String'.
.EXAMPLE
[RegistryUtility]::SetRegistryValue -KeyPath 'Registry::HKCU\Software\MyApp' -Name 'Setting1' -Value 'SomeValue'
Sets the value 'SomeValue' for the 'Setting1' name in the 'Registry::HKCU\Software\MyApp' registry key.
#>
static [void] SetRegistryValue(
[string]$KeyPath,
[string]$Name,
[string]$Value,
[string]$Type = 'String'
) {
try {
# Manual validation for $Type
$validTypes = @('String', 'ExpandString', 'Binary', 'DWord', 'MultiString', 'QWord', 'None')
if ($Type -notin $validTypes) {
throw "Invalid Type specified. Valid options are: $($validTypes -join ', ')"
}
if (-not (Test-Path "Registry::$KeyPath")) {
New-Item -Path "Registry::$KeyPath" -Force > $null
}
Set-ItemProperty -Path "Registry::$KeyPath" -Name $Name -Value $Value -Type $Type
}
catch {
Write-Host "[-] Failed to set registry value at path $KeyPath with name $Name. Error: $_" -ForegroundColor Red
}
}
static [void] EnsureDockerRunning() {
function IsDockerRunning {
try {
docker info > $null 2>&1
return $?
}
catch {
return $false
}
}
# Check if Docker is already running
if (IsDockerRunning) { exit 0 }
# Start Docker Desktop (assuming default installation path)
Start-Process "C:\Program Files\Docker\Docker\Docker Desktop.exe"
# Initialize variables
$timeoutMinutes = 1
$elapsedSeconds = 0
$isDockerRunning = $false
# Wait until Docker is running or timeout is reached
do {
# Check every 5 seconds
Start-Sleep -Seconds 5
$elapsedSeconds += 5
Write-Host "Waiting for Docker to start..."
} while (-not (IsDockerRunning) -and $elapsedSeconds -lt ($timeoutMinutes * 60))
if (-not (IsDockerRunning)) {
Write-Host "Timeout reached. Docker did not start within the specified time."
exit 1
}
}
static [void] ShowFileExtensions() {
# Define the registry path and value name
$regPath = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
$name = "HideFileExt"
# Use the utility function to set the registry value
[Utils]::SetRegistryValue($regPath, $name, 0, 'DWord')
# Optionally, to refresh the explorer view, you can restart the explorer process
Get-Process explorer | Stop-Process -Force
# Wait a bit to ensure the process has terminated
Start-Sleep -Seconds 2
# Restart explorer.exe to manage the desktop and taskbar
Start-Process -WindowStyle Hidden -ArgumentList "/root,::{42eedd0e-20ce-11dd-aa11-0800200c9a66}" -FilePath explorer.exe
}
static [void] Pause([string] $Msg, [int] $Timeout) {
try {
Write-Host "$Msg" -ForegroundColor Yellow
$timer = New-Object System.Diagnostics.Stopwatch
$timer.Start()
while (-not [Console]::KeyAvailable -and $timer.Elapsed.Seconds -lt $Timeout -and $timer.isRunning) {
Start-Sleep -Milliseconds 50
}
if ([Console]::KeyAvailable) {
[void][Console]::ReadKey($true)
}
} catch {
throw $_.Exception.Message
}
}
}
class Registry {
static [hashtable[]] $list = @(
@{name = "HideTaskbarSearch" }
@{name = "DisableTelemetry" }
@{name = "DisableEdgeHubSidebar" }
@{name = "DisableWebSearch" }
@{name = "DisableMapUpdates" }
@{name = "HideChatIcon" }
@{name = "DisableWindowsWidgets" }
)
static [bool] ConfigureWindows() {
try {
foreach ($method in [Registry]::list) {
try {
$expr = "[Registry]::$($method.name)()"
Invoke-Expression $expr
} catch {
Write-Host "[-] Unable to invoke static method [Registry]::$($method.name)()" -ForegroundColor Red
}
}
return $true
} catch {
return $false
}
}
static [void] HideTaskbarSearch() {
Write-Host "[+] Hiding Taskbar Search box / button..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 0
}
static [void] ShowTaskbarSearchIcon() {
Write-Host "[+] Showing Taskbar Search icon..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 1
}
static [void] ShowTaskbarSearchBox() {
Write-Host "[+] Showing Taskbar Search box..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 2
}
# Disable Telemetry
static [void] DisableTelemetry() {
Write-Host "[+] Disabling Telemetry..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "Microsoft Compatibility Appraiser" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "ProgramDataUpdater" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Autochk\" -TaskName "Proxy" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "Consolidator" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "UsbCeip" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\DiskDiagnostic\" -TaskName "Microsoft-Windows-DiskDiagnosticDataCollector" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
}
# Enable Telemetry
static [void] EnableTelemetry() {
Write-Host "[+] Enabling Telemetry..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 3
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 3
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 3
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "Microsoft Compatibility Appraiser" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "ProgramDataUpdater" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Autochk\" -TaskName "Proxy" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "Consolidator" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "UsbCeip" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\DiskDiagnostic\" -TaskName "Microsoft-Windows-DiskDiagnosticDataCollector" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
}
# Disable Web Search in Start Menu
static [void] DisableWebSearch() {
Write-Host "[+] Disabling Bing Search in Start Menu..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -Type DWord -Value 0
If (!(Test-Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search")) {
New-Item -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Force | Out-Null
}
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "DisableWebSearch" -Type DWord -Value 1
}
# Enable Web Search in Start Menu
static [void] EnableWebSearch() {
Write-Host "[+] Enabling Bing Search in Start Menu..." -ForegroundColor Yellow
Remove-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "DisableWebSearch" -ErrorAction SilentlyContinue
}
# Disable Edge HubSidebar
static [void] DisableEdgeHubSidebar() {
Write-Host "[+] Disabling Edge Hub Sidebar..." -ForegroundColor Yellow
If (!(Test-Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Edge")) {
New-Item -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Edge" -Force | Out-Null
}
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Edge" -Name "HubsSidebarEnabled" -Type DWord -Value 0
}
# Enable Edge HubSidebar
static [void] EnableEdgeHubSidebar() {
Write-Host "[+] Enabling Edge Hub Sidebar..." -ForegroundColor Yellow
If (!(Test-Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Edge")) {
New-Item -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Edge" -Force | Out-Null
}
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Edge" -Name "HubsSidebarEnabled" -Type DWord -Value 1
}
# Disable Windows 11 widgets
static [void] DisableWindowsWidgets() {
Write-Host "[+] Disabling Windows 11 widgets..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarDa" -Type DWord -Value 0
}
# Enable Windows 11 widgets
static [void] EnableWindowsWidgets() {
Write-Host "[+] Enabling Windows 11 widgets..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarDa" -Type DWord -Value 1
}
# Disable automatic Maps updates
static [void] DisableMapUpdates() {
Write-Host "[+] Disabling automatic Maps updates..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKLM\SYSTEM\Maps" -Name "AutoUpdateEnabled" -Type DWord -Value 0
}
# Enable automatic Maps updates
static [void] EnableMapUpdates() {
Write-Host "[+] Enabling automatic Maps updates..." -ForegroundColor Yellow
Remove-ItemProperty -Path "Registry::HKLM\SYSTEM\Maps" -Name "AutoUpdateEnabled" -ErrorAction SilentlyContinue
}
# Hide chat icon
static [void] HideChatIcon() {
Write-Host "[+] Hiding taskbar Chat icon..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarMn" -Type DWord -Value 0
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows" -Name "ChatIcon" -Type DWord -Value 0x03
}
# Show chat icon
static [void] ShowChatIcon() {
Write-Host "[+] Showing taskbar Chat icon..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarMn" -Type DWord -Value 1
Remove-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows" -Name "ChatIcon" -ErrorAction SilentlyContinue
}
# Hide explorer file extensions
static [void] HideExplorerFileExtensions() {
Write-Host "[+] Hiding explorer file extensions..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 1
}
# Show explorer file extensions
static [void] ShowExplorerFileExtensions() {
Write-Host "[+] Showing explorer file extensions..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 0
}
}
# Start of script
Set-StrictMode -Version 1.0
$ErrorActionPreference = "Continue"
$ProgressPreference = "SilentlyContinue"
try {
# Set current working directory to user's home directory
Set-Location $HOME\Downloads
# Enable file extensions in Windows Explorer
Write-Host "Enable file extensions in Windows Explorer..." -ForegroundColor Green
[Utils]::ShowFileExtensions()
# Performing Windows Registry hacks
Write-Host "Configuring Windows registry..." -ForegroundColor Green
if ( -Not [Registry]::ConfigureWindows() ) {
Write-Host "[-] Failed to configure Windows registry..." -ForegroundColor Red
}
# Install WinGet
Write-Host "Downloading WinGet and its dependencies..." -ForegroundColor Green
Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x64.14.00.Desktop.appx
Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.7.3/Microsoft.UI.Xaml.2.7.x64.appx -OutFile Microsoft.UI.Xaml.2.7.x64.appx
Add-AppxPackage Microsoft.VCLibs.x64.14.00.Desktop.appx
Add-AppxPackage Microsoft.UI.Xaml.2.7.x64.appx
Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Write-Host "Updating WinGet repository..." -ForegroundColor Green
winget.exe source update
Write-Host "Installing tailscale.tailscale..." -ForegroundColor Green
winget.exe install -h --accept-source-agreements --accept-package-agreements tailscale.tailscale
Write-Host "Installing Google.AndroidStudio..." -ForegroundColor Green
winget.exe install -h --accept-source-agreements --accept-package-agreements Google.AndroidStudio
} catch {
Write-Host "An error occurred: $_" -ForegroundColor Red
} finally {
[Utils]::Pause("Press any key to exit", 10)
}
# Title: Windows 11 Sandbox deployment script - Default
# Author: B. van Wetten
# Description: Deployment script Windows Sandbox
# Last Update: 2023-09-01
# Usage: powershell -Command { Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-WebRequest -UseBasicParsing -Uri 'https://gist.githubusercontent.com/QNimbus/a637b1507b8ba07ede2e52d6ca50e3ac/raw/edc3bccfa40cf8fb637a5a2a618d515f3a2dfc53/Windows%2011%20Sandbox%20deployment%20script%20-%20Default.ps1' | Select-Object -ExpandProperty Content | Invoke-Expression }
# Example config 'Windows Sandbox config.wsb'
#
# <Configuration>
# <LogonCommand>
# <Command>powershell -executionpolicy Unrestricted -Command "start powershell { -Command \"Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-WebRequest -UseBasicParsing -Uri 'https://gist.githubusercontent.com/QNimbus/a637b1507b8ba07ede2e52d6ca50e3ac/raw/edc3bccfa40cf8fb637a5a2a618d515f3a2dfc53/Windows%2011%20Sandbox%20deployment%20script%20-%20Default.ps1' | Select-Object -ExpandProperty Content | Invoke-Expression \"}"</Command>
# </LogonCommand>
# </Configuration>
class Utils {
# Properties, if any
# Constructor, if required
<#
.SYNOPSIS
Sets a value in the Windows registry.
.DESCRIPTION
This method sets a specified value for a given registry key and name.
It will create the key if it doesn't exist.
.PARAMETER KeyPath
The path to the registry key.
.PARAMETER Name
The name of the registry value to set.
.PARAMETER Value
The data to set for the specified registry value.
.PARAMETER Type
The type of the registry value. Valid options include 'String', 'ExpandString',
'Binary', 'DWord', 'MultiString', 'QWord', and 'None'. Default is 'String'.
.EXAMPLE
[RegistryUtility]::SetRegistryValue -KeyPath 'Registry::HKCU\Software\MyApp' -Name 'Setting1' -Value 'SomeValue'
Sets the value 'SomeValue' for the 'Setting1' name in the 'Registry::HKCU\Software\MyApp' registry key.
#>
static [void] SetRegistryValue(
[string]$KeyPath,
[string]$Name,
[string]$Value,
[string]$Type = 'String'
) {
try {
# Manual validation for $Type
$validTypes = @('String', 'ExpandString', 'Binary', 'DWord', 'MultiString', 'QWord', 'None')
if ($Type -notin $validTypes) {
throw "Invalid Type specified. Valid options are: $($validTypes -join ', ')"
}
if (-not (Test-Path "Registry::$KeyPath")) {
New-Item -Path "Registry::$KeyPath" -Force > $null
}
Set-ItemProperty -Path "Registry::$KeyPath" -Name $Name -Value $Value -Type $Type
}
catch {
Write-Host "[-] Failed to set registry value at path $KeyPath with name $Name. Error: $_" -ForegroundColor Red
}
}
static [void] EnsureDockerRunning() {
function IsDockerRunning {
try {
docker info > $null 2>&1
return $?
}
catch {
return $false
}
}
# Check if Docker is already running
if (IsDockerRunning) { exit 0 }
# Start Docker Desktop (assuming default installation path)
Start-Process "C:\Program Files\Docker\Docker\Docker Desktop.exe"
# Initialize variables
$timeoutMinutes = 1
$elapsedSeconds = 0
$isDockerRunning = $false
# Wait until Docker is running or timeout is reached
do {
# Check every 5 seconds
Start-Sleep -Seconds 5
$elapsedSeconds += 5
Write-Host "Waiting for Docker to start..."
} while (-not (IsDockerRunning) -and $elapsedSeconds -lt ($timeoutMinutes * 60))
if (-not (IsDockerRunning)) {
Write-Host "Timeout reached. Docker did not start within the specified time."
exit 1
}
}
static [void] ShowFileExtensions() {
# Define the registry path and value name
$regPath = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
$name = "HideFileExt"
# Use the utility function to set the registry value
[Utils]::SetRegistryValue($regPath, $name, 0, 'DWord')
# Optionally, to refresh the explorer view, you can restart the explorer process
Get-Process explorer | Stop-Process -Force
# Wait a bit to ensure the process has terminated
Start-Sleep -Seconds 2
# Restart explorer.exe to manage the desktop and taskbar
Start-Process -WindowStyle Hidden -ArgumentList "/root,::{42eedd0e-20ce-11dd-aa11-0800200c9a66}" -FilePath explorer.exe
}
static [void] Pause([string] $Msg, [int] $Timeout) {
try {
Write-Host "$Msg" -ForegroundColor Yellow
$timer = New-Object System.Diagnostics.Stopwatch
$timer.Start()
while (-not [Console]::KeyAvailable -and $timer.Elapsed.Seconds -lt $Timeout -and $timer.isRunning) {
Start-Sleep -Milliseconds 50
}
if ([Console]::KeyAvailable) {
[void][Console]::ReadKey($true)
}
} catch {
throw $_.Exception.Message
}
}
}
class Registry {
static [hashtable[]] $list = @(
@{name = "HideTaskbarSearch" }
@{name = "DisableTelemetry" }
@{name = "DisableEdgeHubSidebar" }
@{name = "DisableWebSearch" }
@{name = "DisableMapUpdates" }
@{name = "HideChatIcon" }
@{name = "DisableWindowsWidgets" }
)
static [bool] ConfigureWindows() {
try {
foreach ($method in [Registry]::list) {
try {
$expr = "[Registry]::$($method.name)()"
Invoke-Expression $expr
} catch {
Write-Host "[-] Unable to invoke static method [Registry]::$($method.name)()" -ForegroundColor Red
}
}
return $true
} catch {
return $false
}
}
static [void] HideTaskbarSearch() {
Write-Host "[+] Hiding Taskbar Search box / button..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 0
}
static [void] ShowTaskbarSearchIcon() {
Write-Host "[+] Showing Taskbar Search icon..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 1
}
static [void] ShowTaskbarSearchBox() {
Write-Host "[+] Showing Taskbar Search box..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 2
}
# Disable Telemetry
static [void] DisableTelemetry() {
Write-Host "[+] Disabling Telemetry..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "Microsoft Compatibility Appraiser" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "ProgramDataUpdater" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Autochk\" -TaskName "Proxy" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "Consolidator" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "UsbCeip" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\DiskDiagnostic\" -TaskName "Microsoft-Windows-DiskDiagnosticDataCollector" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
}
# Enable Telemetry
static [void] EnableTelemetry() {
Write-Host "[+] Enabling Telemetry..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 3
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 3
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 3
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "Microsoft Compatibility Appraiser" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "ProgramDataUpdater" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Autochk\" -TaskName "Proxy" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "Consolidator" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "UsbCeip" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\DiskDiagnostic\" -TaskName "Microsoft-Windows-DiskDiagnosticDataCollector" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
}
# Disable Web Search in Start Menu
static [void] DisableWebSearch() {
Write-Host "[+] Disabling Bing Search in Start Menu..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -Type DWord -Value 0
If (!(Test-Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search")) {
New-Item -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Force | Out-Null
}
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "DisableWebSearch" -Type DWord -Value 1
}
# Enable Web Search in Start Menu
static [void] EnableWebSearch() {
Write-Host "[+] Enabling Bing Search in Start Menu..." -ForegroundColor Yellow
Remove-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "DisableWebSearch" -ErrorAction SilentlyContinue
}
# Disable Edge HubSidebar
static [void] DisableEdgeHubSidebar() {
Write-Host "[+] Disabling Edge Hub Sidebar..." -ForegroundColor Yellow
If (!(Test-Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Edge")) {
New-Item -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Edge" -Force | Out-Null
}
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Edge" -Name "HubsSidebarEnabled" -Type DWord -Value 0
}
# Enable Edge HubSidebar
static [void] EnableEdgeHubSidebar() {
Write-Host "[+] Enabling Edge Hub Sidebar..." -ForegroundColor Yellow
If (!(Test-Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Edge")) {
New-Item -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Edge" -Force | Out-Null
}
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Edge" -Name "HubsSidebarEnabled" -Type DWord -Value 1
}
# Disable Windows 11 widgets
static [void] DisableWindowsWidgets() {
Write-Host "[+] Disabling Windows 11 widgets..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarDa" -Type DWord -Value 0
}
# Enable Windows 11 widgets
static [void] EnableWindowsWidgets() {
Write-Host "[+] Enabling Windows 11 widgets..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarDa" -Type DWord -Value 1
}
# Disable automatic Maps updates
static [void] DisableMapUpdates() {
Write-Host "[+] Disabling automatic Maps updates..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKLM\SYSTEM\Maps" -Name "AutoUpdateEnabled" -Type DWord -Value 0
}
# Enable automatic Maps updates
static [void] EnableMapUpdates() {
Write-Host "[+] Enabling automatic Maps updates..." -ForegroundColor Yellow
Remove-ItemProperty -Path "Registry::HKLM\SYSTEM\Maps" -Name "AutoUpdateEnabled" -ErrorAction SilentlyContinue
}
# Hide chat icon
static [void] HideChatIcon() {
Write-Host "[+] Hiding taskbar Chat icon..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarMn" -Type DWord -Value 0
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows" -Name "ChatIcon" -Type DWord -Value 0x03
}
# Show chat icon
static [void] ShowChatIcon() {
Write-Host "[+] Showing taskbar Chat icon..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarMn" -Type DWord -Value 1
Remove-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows" -Name "ChatIcon" -ErrorAction SilentlyContinue
}
# Hide explorer file extensions
static [void] HideExplorerFileExtensions() {
Write-Host "[+] Hiding explorer file extensions..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 1
}
# Show explorer file extensions
static [void] ShowExplorerFileExtensions() {
Write-Host "[+] Showing explorer file extensions..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 0
}
}
# Start of script
Set-StrictMode -Version 1.0
$ErrorActionPreference = "Continue"
$ProgressPreference = "SilentlyContinue"
try {
# Set current working directory to user's home directory
Set-Location $HOME\Downloads
# Enable file extensions in Windows Explorer
Write-Host "Enable file extensions in Windows Explorer..." -ForegroundColor Green
[Utils]::ShowFileExtensions()
# Performing Windows Registry hacks
Write-Host "Configuring Windows registry..." -ForegroundColor Green
if ( -Not [Registry]::ConfigureWindows() ) {
Write-Host "[-] Failed to configure Windows registry..." -ForegroundColor Red
}
# Install WinGet
Write-Host "Downloading WinGet and its dependencies..." -ForegroundColor Green
Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x64.14.00.Desktop.appx
Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.7.3/Microsoft.UI.Xaml.2.7.x64.appx -OutFile Microsoft.UI.Xaml.2.7.x64.appx
Add-AppxPackage Microsoft.VCLibs.x64.14.00.Desktop.appx
Add-AppxPackage Microsoft.UI.Xaml.2.7.x64.appx
Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Write-Host "Updating WinGet repository..." -ForegroundColor Green
winget.exe source update
Write-Host "Installing Brave.Brave..." -ForegroundColor Green
winget.exe install -h --accept-source-agreements --accept-package-agreements Brave.Brave
Write-Host "Installing tailscale.tailscale..." -ForegroundColor Green
winget.exe install -h --accept-source-agreements --accept-package-agreements tailscale.tailscale
} catch {
Write-Host "An error occurred: $_" -ForegroundColor Red
} finally {
[Utils]::Pause("Press any key to exit", 10)
}
# Title: Windows 11 Sandbox deployment script - Usenet
# Author: B. van Wetten
# Description: Deployment script Windows Sandbox
# Last Update: 2023-10-14
# Usage: powershell -Command { Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-WebRequest -UseBasicParsing -Uri 'https://gist.githubusercontent.com/QNimbus/a637b1507b8ba07ede2e52d6ca50e3ac/raw/Windows%2011%20Sandbox%20deployment%20script%20-%20Usenet.ps1' | Select-Object -ExpandProperty Content | Invoke-Expression }
# Example config 'Windows Sandbox config.wsb'
#
# <Configuration>
# <LogonCommand>
# <Command>powershell -executionpolicy Unrestricted -Command "start powershell { -Command \"Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-WebRequest -UseBasicParsing -Uri 'https://gist.githubusercontent.com/QNimbus/a637b1507b8ba07ede2e52d6ca50e3ac/raw/Windows%2011%20Sandbox%20deployment%20script%20-%20Usenet.ps1' | Select-Object -ExpandProperty Content | Invoke-Expression \"}"</Command>
# </LogonCommand>
# </Configuration>
class Utils {
# Properties, if any
# Constructor, if required
<#
.SYNOPSIS
Sets a value in the Windows registry.
.DESCRIPTION
This method sets a specified value for a given registry key and name.
It will create the key if it doesn't exist.
.PARAMETER KeyPath
The path to the registry key.
.PARAMETER Name
The name of the registry value to set.
.PARAMETER Value
The data to set for the specified registry value.
.PARAMETER Type
The type of the registry value. Valid options include 'String', 'ExpandString',
'Binary', 'DWord', 'MultiString', 'QWord', and 'None'. Default is 'String'.
.EXAMPLE
[RegistryUtility]::SetRegistryValue -KeyPath 'Registry::HKCU\Software\MyApp' -Name 'Setting1' -Value 'SomeValue'
Sets the value 'SomeValue' for the 'Setting1' name in the 'Registry::HKCU\Software\MyApp' registry key.
#>
static [void] SetRegistryValue(
[string]$KeyPath,
[string]$Name,
[string]$Value,
[string]$Type = 'String'
) {
try {
# Manual validation for $Type
$validTypes = @('String', 'ExpandString', 'Binary', 'DWord', 'MultiString', 'QWord', 'None')
if ($Type -notin $validTypes) {
throw "Invalid Type specified. Valid options are: $($validTypes -join ', ')"
}
if (-not (Test-Path "Registry::$KeyPath")) {
New-Item -Path "Registry::$KeyPath" -Force > $null
}
Set-ItemProperty -Path "Registry::$KeyPath" -Name $Name -Value $Value -Type $Type
}
catch {
Write-Host "[-] Failed to set registry value at path $KeyPath with name $Name. Error: $_" -ForegroundColor Red
}
}
static [void] EnsureDockerRunning() {
function IsDockerRunning {
try {
docker info > $null 2>&1
return $?
}
catch {
return $false
}
}
# Check if Docker is already running
if (IsDockerRunning) { exit 0 }
# Start Docker Desktop (assuming default installation path)
Start-Process "C:\Program Files\Docker\Docker\Docker Desktop.exe"
# Initialize variables
$timeoutMinutes = 1
$elapsedSeconds = 0
$isDockerRunning = $false
# Wait until Docker is running or timeout is reached
do {
# Check every 5 seconds
Start-Sleep -Seconds 5
$elapsedSeconds += 5
Write-Host "Waiting for Docker to start..."
} while (-not (IsDockerRunning) -and $elapsedSeconds -lt ($timeoutMinutes * 60))
if (-not (IsDockerRunning)) {
Write-Host "Timeout reached. Docker did not start within the specified time."
exit 1
}
}
static [void] ShowFileExtensions() {
# Define the registry path and value name
$regPath = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
$name = "HideFileExt"
# Use the utility function to set the registry value
[Utils]::SetRegistryValue($regPath, $name, 0, 'DWord')
# Optionally, to refresh the explorer view, you can restart the explorer process
Get-Process explorer | Stop-Process -Force
# Wait a bit to ensure the process has terminated
Start-Sleep -Seconds 2
# Restart explorer.exe to manage the desktop and taskbar
Start-Process -WindowStyle Hidden -ArgumentList "/root,::{42eedd0e-20ce-11dd-aa11-0800200c9a66}" -FilePath explorer.exe
}
static [void] Pause([string] $Msg, [int] $Timeout) {
try {
Write-Host "$Msg" -ForegroundColor Yellow
$timer = New-Object System.Diagnostics.Stopwatch
$timer.Start()
while (-not [Console]::KeyAvailable -and $timer.Elapsed.Seconds -lt $Timeout -and $timer.isRunning) {
Start-Sleep -Milliseconds 50
}
if ([Console]::KeyAvailable) {
[void][Console]::ReadKey($true)
}
} catch {
throw $_.Exception.Message
}
}
}
class Registry {
static [hashtable[]] $list = @(
@{name = "HideTaskbarSearch" }
@{name = "DisableTelemetry" }
@{name = "DisableEdgeHubSidebar" }
@{name = "DisableWebSearch" }
@{name = "DisableMapUpdates" }
@{name = "HideChatIcon" }
@{name = "DisableWindowsWidgets" }
)
static [bool] ConfigureWindows() {
try {
foreach ($method in [Registry]::list) {
try {
$expr = "[Registry]::$($method.name)()"
Invoke-Expression $expr
} catch {
Write-Host "[-] Unable to invoke static method [Registry]::$($method.name)()" -ForegroundColor Red
}
}
return $true
} catch {
return $false
}
}
static [void] HideTaskbarSearch() {
Write-Host "[+] Hiding Taskbar Search box / button..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 0
}
static [void] ShowTaskbarSearchIcon() {
Write-Host "[+] Showing Taskbar Search icon..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 1
}
static [void] ShowTaskbarSearchBox() {
Write-Host "[+] Showing Taskbar Search box..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 2
}
# Disable Telemetry
static [void] DisableTelemetry() {
Write-Host "[+] Disabling Telemetry..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "Microsoft Compatibility Appraiser" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "ProgramDataUpdater" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Autochk\" -TaskName "Proxy" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "Consolidator" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "UsbCeip" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\DiskDiagnostic\" -TaskName "Microsoft-Windows-DiskDiagnosticDataCollector" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
}
# Enable Telemetry
static [void] EnableTelemetry() {
Write-Host "[+] Enabling Telemetry..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 3
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 3
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 3
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "Microsoft Compatibility Appraiser" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "ProgramDataUpdater" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Autochk\" -TaskName "Proxy" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "Consolidator" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "UsbCeip" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\DiskDiagnostic\" -TaskName "Microsoft-Windows-DiskDiagnosticDataCollector" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
}
# Disable Web Search in Start Menu
static [void] DisableWebSearch() {
Write-Host "[+] Disabling Bing Search in Start Menu..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -Type DWord -Value 0
If (!(Test-Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search")) {
New-Item -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Force | Out-Null
}
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "DisableWebSearch" -Type DWord -Value 1
}
# Enable Web Search in Start Menu
static [void] EnableWebSearch() {
Write-Host "[+] Enabling Bing Search in Start Menu..." -ForegroundColor Yellow
Remove-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "DisableWebSearch" -ErrorAction SilentlyContinue
}
# Disable Edge HubSidebar
static [void] DisableEdgeHubSidebar() {
Write-Host "[+] Disabling Edge Hub Sidebar..." -ForegroundColor Yellow
If (!(Test-Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Edge")) {
New-Item -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Edge" -Force | Out-Null
}
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Edge" -Name "HubsSidebarEnabled" -Type DWord -Value 0
}
# Enable Edge HubSidebar
static [void] EnableEdgeHubSidebar() {
Write-Host "[+] Enabling Edge Hub Sidebar..." -ForegroundColor Yellow
If (!(Test-Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Edge")) {
New-Item -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Edge" -Force | Out-Null
}
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Edge" -Name "HubsSidebarEnabled" -Type DWord -Value 1
}
# Disable Windows 11 widgets
static [void] DisableWindowsWidgets() {
Write-Host "[+] Disabling Windows 11 widgets..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarDa" -Type DWord -Value 0
}
# Enable Windows 11 widgets
static [void] EnableWindowsWidgets() {
Write-Host "[+] Enabling Windows 11 widgets..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarDa" -Type DWord -Value 1
}
# Disable automatic Maps updates
static [void] DisableMapUpdates() {
Write-Host "[+] Disabling automatic Maps updates..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKLM\SYSTEM\Maps" -Name "AutoUpdateEnabled" -Type DWord -Value 0
}
# Enable automatic Maps updates
static [void] EnableMapUpdates() {
Write-Host "[+] Enabling automatic Maps updates..." -ForegroundColor Yellow
Remove-ItemProperty -Path "Registry::HKLM\SYSTEM\Maps" -Name "AutoUpdateEnabled" -ErrorAction SilentlyContinue
}
# Hide chat icon
static [void] HideChatIcon() {
Write-Host "[+] Hiding taskbar Chat icon..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarMn" -Type DWord -Value 0
Set-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows" -Name "ChatIcon" -Type DWord -Value 0x03
}
# Show chat icon
static [void] ShowChatIcon() {
Write-Host "[+] Showing taskbar Chat icon..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarMn" -Type DWord -Value 1
Remove-ItemProperty -Path "Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows" -Name "ChatIcon" -ErrorAction SilentlyContinue
}
# Hide explorer file extensions
static [void] HideExplorerFileExtensions() {
Write-Host "[+] Hiding explorer file extensions..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 1
}
# Show explorer file extensions
static [void] ShowExplorerFileExtensions() {
Write-Host "[+] Showing explorer file extensions..." -ForegroundColor Yellow
Set-ItemProperty -Path "Registry::HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 0
}
}
# Start of script
Set-StrictMode -Version 1.0
$ErrorActionPreference = "Continue"
$ProgressPreference = "SilentlyContinue"
try {
# Set current working directory to user's home directory
Set-Location $HOME\Downloads
# Enable file extensions in Windows Explorer
Write-Host "Enable file extensions in Windows Explorer..." -ForegroundColor Green
[Utils]::ShowFileExtensions()
# Performing Windows Registry hacks
Write-Host "Configuring Windows registry..." -ForegroundColor Green
if ( -Not [Registry]::ConfigureWindows() ) {
Write-Host "[-] Failed to configure Windows registry..." -ForegroundColor Red
}
# Install WinGet
Write-Host "Downloading WinGet and its dependencies..." -ForegroundColor Green
Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x64.14.00.Desktop.appx
Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.7.3/Microsoft.UI.Xaml.2.7.x64.appx -OutFile Microsoft.UI.Xaml.2.7.x64.appx
Add-AppxPackage Microsoft.VCLibs.x64.14.00.Desktop.appx
Add-AppxPackage Microsoft.UI.Xaml.2.7.x64.appx
Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Write-Host "Updating WinGet repository..." -ForegroundColor Green
winget.exe source update
Write-Host "Installing nzbget.nzbget..." -ForegroundColor Green
winget.exe install -h --accept-source-agreements --accept-package-agreements nzbget.nzbget
Write-Host "Installing Brave.Brave..." -ForegroundColor Green
winget.exe install -h --accept-source-agreements --accept-package-agreements nzbget.nzbget
} catch {
Write-Host "An error occurred: $_" -ForegroundColor Red
} finally {
[Utils]::Pause("Press any key to exit", 10)
}
<Configuration>
<LogonCommand>
<Command>powershell -executionpolicy unrestricted -command "start powershell {-WindowStyle Minimized -noexit -command \"Set-ExecutionPolicy Bypass -Scope Process -Force; . { iwr -useb https://boxstarter.org/bootstrapper.ps1 } | iex; Get-Boxstarter -Force; Install-BoxstarterPackage -PackageName https://gist.githubusercontent.com/QNimbus/a637b1507b8ba07ede2e52d6ca50e3ac/raw/1b00343a9e2a70de04c17a1734892d2644561ce1/boxstarter-sandbox.ps1\"}"</Command>
</LogonCommand>
</Configuration>
# Title: Windows 11 Deployment Script
# Author: B. van Wetten
# Description: Deployment script for Windows 11 that also performs
# some basic configuration and removes Windows bloatware.
# Last Update: 2023-03-24
#
# Prerequisites:
# - Winget: Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe
# - Powershell 7.0+: winget install -h --accept-source-agreements --accept-package-agreements Microsoft.Powershell
# - Get-WinCredential: Install-Module -Name Get-WinCredential
#
# Download: pwsh -ExecutionPolicy Unrestricted -Command { Start-Process pwsh { -NoLogo -Command "Invoke-WebRequest -OutFile .\Windows-Installer.ps1 -Uri 'https://gist.githubusercontent.com/QNimbus/a637b1507b8ba07ede2e52d6ca50e3ac/raw/Windows-Installer.ps1'" } }
# Usage: pwsh -ExecutionPolicy Unrestricted -Command { Start-Process pwsh { -NoLogo -File .\Windows-Installer.ps1 } }
Set-Variable -Name ProgressPreference -Value "SilentlyContinue"
[Main]::Start()
[Utils]::Pause("Press any key to exit", 10)
# [Utils]::GetFileBase64("C:\Users\bas\Desktop\Windows Terminal.lnk")
# [Utils]::GetBinaryData()
class Main {
static [void] Start() {
# Check to make sure script is run as administrator
Write-Host "[+] Checking if script is running as administrator..." -ForegroundColor Green
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal( [Security.Principal.WindowsIdentity]::GetCurrent() )
if (-Not $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host "[-] Please run this script as administrator`n" -ForegroundColor Red
[Utils]::Pause("Press any key to continue", 5)
exit
}
Write-Host "[+] Removing bloatware" -ForegroundColor Green
if ( -Not [Bloatware]::Remove() ) {
Write-Host "[-] Failed to remove bloatware" -ForegroundColor Red
}
Write-Host "[+] Installing apps" -ForegroundColor Green
if ( -Not [Apps]::Install() ) {
Write-Host "[-] Failed to install apps" -ForegroundColor Red
}
Write-Host "[+] Enabling Windows features" -ForegroundColor Green
if ( -Not [WindowsFeatures]::Enable() ) {
Write-Host "[-] Failed to enable Windows features" -ForegroundColor Red
}
Write-Host "[+] Configuring Windows services" -ForegroundColor Green
if ( -Not [WindowsServices]::Configure() ) {
Write-Host "[-] Failed to configure Windows services" -ForegroundColor Red
}
Write-Host "[+] Setting up Windows Subsystem for Linux (WSL2)" -ForegroundColor Green
if ( -Not [WSL2]::Setup() ) {
Write-Host "[-] Failed to set up WSL2" -ForegroundColor Red
}
Write-Host "[+] Configuring Windows registry" -ForegroundColor Green
if ( -Not [Registry]::ConfigureWindows() ) {
Write-Host "[-] Failed to configure Windows registry" -ForegroundColor Red
}
Write-Host "[+] Performing cleanup" -ForegroundColor Green
[Utils]::RemoveFiles()
Write-Host "[+] Restarting explorer.exe" -ForegroundColor Green
[Utils]::RestartExplorer()
}
}
class Bloatware {
static [string[]] $list = @(
"MicrosoftTeams"
"Microsoft.WindowsAlarms"
"Microsoft.windowscommunicationsapps"
"Microsoft.Todos"
"Microsoft.BingFinance"
"Microsoft.3DBuilder"
"Microsoft.BingNews"
"Microsoft.BingSports"
"Microsoft.BingWeather"
"Microsoft.CommsPhone"
"Microsoft.Getstarted"
"Microsoft.WindowsMaps"
"*MarchofEmpires*"
"Microsoft.GetHelp"
"Microsoft.Messaging"
"*Minecraft*"
"Microsoft.MicrosoftOfficeHub"
"Microsoft.OneConnect"
"Microsoft.WindowsPhone"
"Microsoft.Windows.Photos"
"Microsoft.WindowsSoundRecorder"
"*Solitaire*"
"Microsoft.MicrosoftStickyNotes"
"Microsoft.Office.Sway"
"Microsoft.XboxApp"
"Microsoft.XboxIdentityProvider"
# "XBox*"
# "Microsoft.XboxGameOverlay"
# "Microsoft.XboxGamingOverlay"
"Microsoft.ZuneMusic"
"Microsoft.ZuneVideo"
"Microsoft.NetworkSpeedTest"
"Microsoft.FreshPaint"
"Microsoft.Print3D"
"Microsoft.People*"
"Microsoft.Microsoft3DViewer"
"Microsoft.MixedReality.Portal*"
"Clipchamp.Clipchamp"
"*Skype*"
"*Autodesk*"
"*BubbleWitch*"
"king.com*"
"G5*"
"*Dell*"
"*Facebook*"
"*Keeper*"
"*Netflix*"
"*Twitter*"
"*Plex*"
)
static [bool] Remove() {
try {
foreach ($app in [Bloatware]::list) {
Write-Host "[++] Attempting to remove $app" -ForegroundColor Green
[Utils]::RemoveApp($app)
}
return $true
} catch {
Write-Host "[--] Error: $_" -ForegroundColor Red
return $false
}
}
}
class Apps {
static [hashtable[]] $list = @(
# @{id = "Microsoft.VisualStudioCode" },
@{id = "Microsoft.WindowsTerminal" },
@{id = "Git.Git" },
@{id = "gerardog.gsudo" },
@{id = "JanDeDobbeleer.OhMyPosh" },
@{id = "GPSoftware.DirectoryOpus" },
@{id = "RoyalApps.RoyalTS.V7" },
@{id = "Docker.DockerDesktop" },
@{id = "tailscale.tailscale" },
@{id = "WireGuard.WireGuard" },
# @{id = "KurtZimmermann.RegCool" },
@{id = "9NKSQGP7F2NH"; name = "WhatsApp" },
@{id = "TechPowerUp.NVCleanstall" },
@{id = "evernote.evernote" },
# @{id = "Axosoft.GitKraken" },
@{id = "Valve.Steam" },
@{id = "EpicGames.EpicGamesLauncher" }
# @{id = "Microsoft.Office"; override = "/configure ""C:\Users\bas\Downloads\Office 365 config.xml""" }
# @{id = "9PD11RQ8QC9K"; name = "Dell Power Manager" }
# @{id = "Microsoft.PowerShell" },
# @{id = "Spotify.Spotify"; asUser = $true }
)
static [bool] Install() {
try {
foreach ($app in [Apps]::list) {
$appName = $($app.id ? $app.id : $app.name)
$appDisplayName = $($app.name ? $app.name : $app.id)
$listApp = $(winget list --exact -q "$appName")
if (![String]::Join("", $listApp).Contains($appName)) {
if ( -Not $app.asUser) {
Write-Host "[++] Attempting to install globally '$($appDisplayName)' " -NoNewline -ForegroundColor Green
winget install -h --accept-source-agreements --accept-package-agreements "$appName" $($app.override ? "--override '$($app.override)'" : $null) | Out-Null
$? ? (Write-Host "success" -ForegroundColor Green) : (Write-Host "failed" -ForegroundColor Red)
} else {
Write-Host "`[++] Attempting to install '$($appDisplayName)' for user '$([System.Environment]::UserName)' " -NoNewline -ForegroundColor Green
$credential = Get-WinCredential -Title $($appDisplayName) -Message "Please provide credentials for installation" -UserName $([System.Environment]::UserName)
$result = Start-Job -Credential $credential -ArgumentList "$appName" -ScriptBlock {
param([string] $appName)
winget install -h --scope user --accept-source-agreements --accept-package-agreements $appName $($app.override ? "--override '$($app.override)'" : $null) | Out-Null
return [bool] $?
} | Wait-Job | Receive-Job
[bool] $result ? (Write-Host "success" -ForegroundColor Green) : (Write-Host "failed" -ForegroundColor Red)
}
} else {
Write-host "[++] Already installed, skipping '$($appDisplayName)'" -ForegroundColor Blue
}
}
return $true
} catch {
Write-Host "[--] Error: $_" -ForegroundColor Red
return $false
}
}
}
class WindowsFeatures {
static [hashtable[]] $list = @(
@{name = "OpenSSH.Client~~~~0.0.1.0"; isCapability = $True },
@{name = "OpenSSH.Server~~~~0.0.1.0"; isCapability = $True },
@{name = "VirtualMachinePlatform" },
@{name = "Microsoft-Windows-Subsystem-Linux" },
@{name = "Containers-DisposableClientVM" }
);
static [bool] Enable() {
try {
foreach ($feature in [WindowsFeatures]::list) {
if ($($feature.isCapability)) {
If ((Get-WindowsCapability -Online -Name $($feature.name)).State -ne 'Installed') {
Write-Host "[++] Attempting to install Windows capability '$($feature.name)'" -ForegroundColor Green
Add-WindowsCapability -Online -Name $($feature.name)
} else {
Write-Host "[++] Windows capability '$($feature.name)' already installed" -ForegroundColor Green
}
} else {
If ((Get-WindowsOptionalFeature -Online -FeatureName $($feature.name)).State -ne 'Enabled') {
Write-Host "[++] Attempting to enable Windows optional feature '$($feature.name)'" -ForegroundColor Green
Enable-WindowsOptionalFeature -Online -FeatureName $($feature.name) -All -NoRestart -ErrorAction SilentlyContinue
} else {
Write-Host "[++] Windows optional feature '$($feature.name)' already enabled" -ForegroundColor Green
}
}
}
return $True
} catch {
Write-Host $_
return $False
}
}
}
class Registry {
static [hashtable[]] $list = @(
@{name = "HideTaskbarSearch" }
@{name = "DisableTelemetry" }
@{name = "DisableEdgeHubSidebar" }
@{name = "DisableWebSearch" }
@{name = "DisableMapUpdates" }
@{name = "HideChatIcon" }
@{name = "DisableWindowsWidgets" }
)
static [bool] ConfigureWindows() {
try {
foreach ($method in [Registry]::list) {
try {
$expr = "[Registry]::$($method.name)()"
Invoke-Expression $expr
} catch {
Write-Host "[--] Unable to invoke static method [Registry]::$($method.name)()" -ForegroundColor Red
}
}
Write-Host "[++] Restore pinned taskbar icons..." -ForegroundColor Yellow
[Utils]::RestorePinnedTaskbarIcons()
Write-Host "[++] Restore desktop icons..." -ForegroundColor Yellow
[Utils]::RestoreDesktopIcons()
return $true
} catch {
return $false
}
}
static [void] HideTaskbarSearch() {
Write-Host "[++] Hiding Taskbar Search box / button..." -ForegroundColor Yellow
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 0
}
static [void] ShowTaskbarSearchIcon() {
Write-Host "[++] Showing Taskbar Search icon..." -ForegroundColor Yellow
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 1
}
static [void] ShowTaskbarSearchBox() {
Write-Host "[++] Showing Taskbar Search box..." -ForegroundColor Yellow
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 2
}
# Disable Telemetry
static [void] DisableTelemetry() {
Write-Host "[++] Disabling Telemetry..." -ForegroundColor Yellow
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
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "Microsoft Compatibility Appraiser" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "ProgramDataUpdater" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Autochk\" -TaskName "Proxy" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "Consolidator" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "UsbCeip" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\DiskDiagnostic\" -TaskName "Microsoft-Windows-DiskDiagnosticDataCollector" -ErrorAction SilentlyContinue | Disable-ScheduledTask | Out-Null
}
# Enable Telemetry
static [void] EnableTelemetry() {
Write-Host "[++] Enabling Telemetry..." -ForegroundColor Yellow
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 3
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 3
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 3
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "Microsoft Compatibility Appraiser" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Application Experience\" -TaskName "ProgramDataUpdater" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Autochk\" -TaskName "Proxy" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "Consolidator" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Customer Experience Improvement Program\" -TaskName "UsbCeip" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
Get-ScheduledTask -TaskPath "\Microsoft\Windows\DiskDiagnostic\" -TaskName "Microsoft-Windows-DiskDiagnosticDataCollector" -ErrorAction SilentlyContinue | Enable-ScheduledTask | Out-Null
}
# Disable Web Search in Start Menu
static [void] DisableWebSearch() {
Write-Host "[++] Disabling Bing Search in Start Menu..." -ForegroundColor Yellow
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
}
# Enable Web Search in Start Menu
static [void] EnableWebSearch() {
Write-Host "[++] Enabling Bing Search in Start Menu..." -ForegroundColor Yellow
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "DisableWebSearch" -ErrorAction SilentlyContinue
}
# Disable Edge HubSidebar
static [void] DisableEdgeHubSidebar() {
Write-Host "[++] Disabling Edge Hub Sidebar..." -ForegroundColor Yellow
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Edge")) {
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Edge" -Force | Out-Null
}
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Edge" -Name "HubsSidebarEnabled" -Type DWord -Value 0
}
# Enable Edge HubSidebar
static [void] EnableEdgeHubSidebar() {
Write-Host "[++] Enabling Edge Hub Sidebar..." -ForegroundColor Yellow
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Edge")) {
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Edge" -Force | Out-Null
}
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Edge" -Name "HubsSidebarEnabled" -Type DWord -Value 1
}
# Disable Windows 11 widgets
static [void] DisableWindowsWidgets() {
Write-Host "[++] Disabling Windows 11 widgets..." -ForegroundColor Yellow
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarDa" -Type DWord -Value 0
}
# Enable Windows 11 widgets
static [void] EnableWindowsWidgets() {
Write-Host "[++] Enabling Windows 11 widgets..." -ForegroundColor Yellow
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarDa" -Type DWord -Value 1
}
# Disable automatic Maps updates
static [void] DisableMapUpdates() {
Write-Host "[++] Disabling automatic Maps updates..." -ForegroundColor Yellow
Set-ItemProperty -Path "HKLM:\SYSTEM\Maps" -Name "AutoUpdateEnabled" -Type DWord -Value 0
}
# Enable automatic Maps updates
static [void] EnableMapUpdates() {
Write-Host "[++] Enabling automatic Maps updates..." -ForegroundColor Yellow
Remove-ItemProperty -Path "HKLM:\SYSTEM\Maps" -Name "AutoUpdateEnabled" -ErrorAction SilentlyContinue
}
# Hide chat icon
static [void] HideChatIcon() {
Write-Host "[++] Hiding taskbar Chat icon..." -ForegroundColor Yellow
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarMn" -Type DWord -Value 0
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows" -Name "ChatIcon" -Type DWord -Value 0x03
}
# Show chat icon
static [void] ShowChatIcon() {
Write-Host "[++] Showing taskbar Chat icon..." -ForegroundColor Yellow
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarMn" -Type DWord -Value 1
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows" -Name "ChatIcon" -ErrorAction SilentlyContinue
}
}
class WindowsServices {
static [hashtable[]] $list = @(
@{name = "ssh-agent"; startupType = "disabled"; start = $False }
@{name = "KAPSService"; startupType = "disabled"; start = $False }
@{name = "Killer Analytics Service"; startupType = "disabled"; start = $False }
@{name = "Killer Network Service"; startupType = "disabled"; start = $False }
@{name = "KNDBWM"; startupType = "disabled"; start = $False }
)
static [bool] Configure() {
try {
foreach ($service in [WindowsServices]::list) {
$displayName = $(Get-service -Name $service.name).DisplayName
if ($?) {
Set-Service $service.name -StartupType $service.startupType
if ($service.start) {
Write-Host "[++] Attempt to start service '$displayName': " -NoNewline -ForegroundColor Yellow
Start-Service $service.name -WarningAction SilentlyContinue
$? ? (Write-Host "success" -ForegroundColor Green) : (Write-Host "failed" -ForegroundColor Red)
} else {
Write-Host "[++] Attempt to stop service '$displayName': " -NoNewline -ForegroundColor Yellow
Stop-Service $service.name -WarningAction SilentlyContinue
$? ? (Write-Host "success" -ForegroundColor Green) : (Write-Host "failed" -ForegroundColor Red)
}
}
}
return $true
} catch {
return $false
}
}
}
class WSL2 {
static [bool] Setup() {
try {
wsl --set-default-version 2
wsl --install --no-launch --distribution Ubuntu-22.04
return $True
} catch {
return $False
}
}
}
class Utils {
static [void] Pause ([string] $msg, [int] $timeout) {
try {
Write-Host "$msg" -ForegroundColor Yellow
$timer = New-Object System.Diagnostics.Stopwatch
$timer.Start()
while (-not [Console]::KeyAvailable -and $timer.Elapsed.Seconds -lt $timeout -and $timer.isRunning) {
Start-Sleep -Milliseconds 50
}
if ([Console]::KeyAvailable) {
[void][Console]::ReadKey($true)
}
} catch {
throw $_.Exception.Message
}
}
static [void] RemoveApp([string] $appName) {
Get-AppxPackage $appName -AllUsers | Remove-AppxPackage
Get-AppXProvisionedPackage -Online | Where-Object DisplayName -like $appName | Remove-AppxProvisionedPackage -Online
}
static [void] RestorePinnedTaskbarIcons() {
Remove-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -Recurse -ErrorAction SilentlyContinue
Remove-Item "$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\*.lnk" -ErrorAction SilentlyContinue
try {
[Taskbar]::RestoreFiles()
[Taskbar]::RestoreRegistry()
} catch {
throw $_.Exception.Message
}
}
static [void] RestoreDesktopIcons() {
Remove-Item "$env:PUBLIC\Desktop\*.lnk" -ErrorAction SilentlyContinue
Remove-Item "$env:USERPROFILE\Desktop\*.lnk" -ErrorAction SilentlyContinue
[DesktopIcons]::RestoreRegistry()
}
static [void] RestartExplorer() {
taskkill /f /im explorer.exe
Start-Process explorer.exe
}
static [string] WriteFile([string] $encodedString, $path = ('{0}\{1}' -f $env:TEMP, [System.Guid]::NewGuid().ToString())) {
try {
$bytes = [System.Convert]::FromBase64String($encodedString);
[System.IO.File]::WriteAllBytes($path, $bytes);
return Get-Item -Path $path;
}
catch {
throw $_.Exception.Message
}
}
static [string] GetFileBase64([string] $path) {
try {
$file = [System.IO.File]::ReadAllBytes($path);
return [System.Convert]::ToBase64String($file);
} catch {
throw $_.Exception.Message
}
}
static [void] GetBinaryData() {
try {
Clear-Host
foreach ($registry in [Taskbar]::registry) {
$value = Get-ItemPropertyValue -Path $registry.path -Name $registry.name
$out = ($value | ForEach-Object { '{0:X2}' -f $_ }) -join ''
Write-Host ('{0}\{1} : {2}' -f $registry.path, $registry.name, $out)
}
} catch {
throw $_.Exception.Message
}
}
static [void] RemoveFiles() {
[hashtable[]] $list = @(
@{path = "C:\Dell"; recursive = $True}
@{path = "C:\Intel"; recursive = $True}
@{path = "C:\PerfLogs"; recursive = $True}
)
try {
foreach ($item in $list) {
Write-Host "[++] Attempting to remove '$($item.path)'" -ForegroundColor Yellow
($item.recursive `
? {Remove-Item -Path $item.path -Recurse -Force -ErrorAction SilentlyContinue} `
: {Remove-Item -Path $item.path -Force -ErrorAction SilentlyContinue})
}
} catch { }
}
}
class Taskbar {
static [hashtable[]] $registry = @(
@{path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband"; name = "Favorites"; propertyType = "Binary"; data = "00760100003A001F80C827341F105C1042AA032EE45287D668260001002600EFBE12000000053783FDB757D90127E55B24B857D9010BD0B1309A5CD901140056003100000000007556D4A411005461736B42617200400009000400EFBE70563D1C7656CC3D2E000000498501000000010000000000000000000000000000001715E0005400610073006B0042006100720000001600E4003200790500007656454520004449524543547E312E4C4E4B0000560009000400EFBE76564545765645452E000000E501060000002A0000000000000000000000000000009AE23E004400690072006500630074006F007200790020004F007000750073002E006C006E006B0000001C00120000002B00EFBE2B08B3309A5CD9011C00220000001E00EFBE02005500730065007200500069006E006E006500640000001C003E0000001D00EFBE02004700500053006F006600740077006100720065002E004400690072006500630074006F00720079004F0070007500730000001C00000000B205000014001F809BD434424502F34DB7803893943456E19C050000FE0441505053EC04080003000000000000007C0200003153505355284C9F799F394BA8D0E1D42DE1D5F36100000011000000001F000000280000004D006900630072006F0073006F00660074002E00570069006E0064006F00770073005400650072006D0069006E0061006C005F003800770065006B0079006200330064003800620062007700650000001100000027000000000B000000FFFF0000110000000E00000000130000000200000011000000190000000013000000010000008500000015000000001F0000003A0000004D006900630072006F0073006F00660074002E00570069006E0064006F00770073005400650072006D0069006E0061006C005F0031002E00310036002E00310030003200360032002E0030005F007800360034005F005F003800770065006B0079006200330064003800620062007700650000006900000005000000001F0000002C0000004D006900630072006F0073006F00660074002E00570069006E0064006F00770073005400650072006D0069006E0061006C005F003800770065006B0079006200330064003800620062007700650021004100700070000000C10000000F000000001F0000005700000043003A005C00500072006F006700720061006D002000460069006C00650073005C00570069006E0064006F007700730041007000700073005C004D006900630072006F0073006F00660074002E00570069006E0064006F00770073005400650072006D0069006E0061006C005F0031002E00310036002E00310030003200360032002E0030005F007800360034005F005F003800770065006B00790062003300640038006200620077006500000000001D00000020000000004800000066D292D54A04F745A23B89A294714DA900000000CD010000315350534D0BD48669903C44819A2A54090DCCEC4D0000000C000000001F0000001D00000049006D0061006700650073005C0053007100750061007200650031003500300078003100350030004C006F0067006F002E0070006E006700000000004900000002000000001F0000001B00000049006D0061006700650073005C00530071007500610072006500340034007800340034004C006F0067006F002E0070006E00670000000000490000000D000000001F0000001B00000049006D0061006700650073005C00570069006400650033003100300078003100350030004C006F0067006F002E0070006E00670000000000110000000400000000130000000078D4FF11000000050000000013000000FFFFFFFF3D00000013000000001F0000001500000049006D0061006700650073005C004C006100720067006500540069006C0065002E0070006E00670000000000110000000E0000000013000000A1040000250000000B000000001F000000090000005400650072006D0069006E0061006C00000000003D00000014000000001F0000001500000049006D0061006700650073005C0053006D0061006C006C00540069006C0065002E0070006E00670000000000000000003100000031535053B1166D44AD8D7048A748402EA43D788C15000000640000000015000000A90400000000000000000000410000003153505330F125B7EF471A10A5F102608C9EEBAC250000000A000000001F000000090000005400650072006D0069006E0061006C0000000000000000002D00000031535053B377ED0D14C66C45AE5B285B38D7B01B110000000700000000130000000000000000000000000000000000120000002B00EFBE8862092C9B5CD9010405640000001D00EFBE02004D006900630072006F0073006F00660074002E00570069006E0064006F00770073005400650072006D0069006E0061006C005F003800770065006B00790062003300640038006200620077006500210041007000700000000405220000001E00EFBE02005500730065007200500069006E006E006500640000000405000000520100003A001F80C827341F105C1042AA032EE45287D668260001002600EFBE12000000053783FDB757D90127E55B24B857D90129BE3F3A9A5CD901140056003100000000007656454511005461736B42617200400009000400EFBE70563D1C765645452E00000049850100000001000000000000000000000000000000BA573F005400610073006B0042006100720000001600C0003200860900007356A64D20004D4943524F537E312E4C4E4B0000560009000400EFBE76564D4576564D452E000000AD25060000000D000000000000000000000000000000A3D88D004D006900630072006F0073006F0066007400200045006400670065002E006C006E006B0000001C00120000002B00EFBE4215403A9A5CD9011C00220000001E00EFBE02005500730065007200500069006E006E006500640000001C001A0000001D00EFBE02004D005300450064006700650000001C000000FF" }
@{path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband"; name = "FavoritesResolve"; propertyType = "Binary"; data = "080300004C0000000114020000000000C00000000000004683008000200000004645B2309A5CD9012B08B3309A5CD90166BAB2309A5CD90179050000000000000100000000000000000000000000000076013A001F80C827341F105C1042AA032EE45287D668260001002600EFBE12000000053783FDB757D90127E55B24B857D9010BD0B1309A5CD901140056003100000000007556D4A411005461736B42617200400009000400EFBE70563D1C7656CC3D2E000000498501000000010000000000000000000000000000001715E0005400610073006B0042006100720000001600E4003200790500007656454520004449524543547E312E4C4E4B0000560009000400EFBE76564545765645452E000000E501060000002A0000000000000000000000000000009AE23E004400690072006500630074006F007200790020004F007000750073002E006C006E006B0000001C00220000001E00EFBE02005500730065007200500069006E006E006500640000001C00120000002B00EFBE2B08B3309A5CD9011C003E0000001D00EFBE02004700500053006F006600740077006100720065002E004400690072006500630074006F00720079004F0070007500730000001C0000009B0000001C000000010000001C0000002D000000000000009A0000001100000003000000F3E6EE6A1000000000433A5C55736572735C6261735C417070446174615C526F616D696E675C4D6963726F736F66745C496E7465726E6574204578706C6F7265725C517569636B204C61756E63685C557365722050696E6E65645C5461736B4261725C4469726563746F7279204F7075732E6C6E6B000060000000030000A058000000000000006C6170746F70000000000000000000003C0F4E300424BB478D1C94F009EE61D308CDD1081DC8ED11BC204C796ED737593C0F4E300424BB478D1C94F009EE61D308CDD1081DC8ED11BC204C796ED7375945000000090000A03900000031535053B1166D44AD8D7048A748402EA43D788C1D000000680000000048000000D15C644BD685944F94138D6EB0EE6668000000000000000000000000040600004C0000000114020000000000C0000000000000468100800000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000B20514001F809BD434424502F34DB7803893943456E19C050000FE0441505053EC04080003000000000000007C0200003153505355284C9F799F394BA8D0E1D42DE1D5F36100000011000000001F000000280000004D006900630072006F0073006F00660074002E00570069006E0064006F00770073005400650072006D0069006E0061006C005F003800770065006B0079006200330064003800620062007700650000001100000027000000000B000000FFFF0000110000000E00000000130000000200000011000000190000000013000000010000008500000015000000001F0000003A0000004D006900630072006F0073006F00660074002E00570069006E0064006F00770073005400650072006D0069006E0061006C005F0031002E00310036002E00310030003200360032002E0030005F007800360034005F005F003800770065006B0079006200330064003800620062007700650000006900000005000000001F0000002C0000004D006900630072006F0073006F00660074002E00570069006E0064006F00770073005400650072006D0069006E0061006C005F003800770065006B0079006200330064003800620062007700650021004100700070000000C10000000F000000001F0000005700000043003A005C00500072006F006700720061006D002000460069006C00650073005C00570069006E0064006F007700730041007000700073005C004D006900630072006F0073006F00660074002E00570069006E0064006F00770073005400650072006D0069006E0061006C005F0031002E00310036002E00310030003200360032002E0030005F007800360034005F005F003800770065006B00790062003300640038006200620077006500000000001D00000020000000004800000066D292D54A04F745A23B89A294714DA900000000CD010000315350534D0BD48669903C44819A2A54090DCCEC4D0000000C000000001F0000001D00000049006D0061006700650073005C0053007100750061007200650031003500300078003100350030004C006F0067006F002E0070006E006700000000004900000002000000001F0000001B00000049006D0061006700650073005C00530071007500610072006500340034007800340034004C006F0067006F002E0070006E00670000000000490000000D000000001F0000001B00000049006D0061006700650073005C00570069006400650033003100300078003100350030004C006F0067006F002E0070006E00670000000000110000000400000000130000000078D4FF11000000050000000013000000FFFFFFFF3D00000013000000001F0000001500000049006D0061006700650073005C004C006100720067006500540069006C0065002E0070006E00670000000000110000000E0000000013000000A1040000250000000B000000001F000000090000005400650072006D0069006E0061006C00000000003D00000014000000001F0000001500000049006D0061006700650073005C0053006D0061006C006C00540069006C0065002E0070006E00670000000000000000003100000031535053B1166D44AD8D7048A748402EA43D788C15000000640000000015000000A90400000000000000000000410000003153505330F125B7EF471A10A5F102608C9EEBAC250000000A000000001F000000090000005400650072006D0069006E0061006C0000000000000000002D00000031535053B377ED0D14C66C45AE5B285B38D7B01B110000000700000000130000000000000000000000000000000000220000001E00EFBE02005500730065007200500069006E006E006500640000000405120000002B00EFBE8862092C9B5CD9010405640000001D00EFBE02004D006900630072006F0073006F00660074002E00570069006E0064006F00770073005400650072006D0069006E0061006C005F003800770065006B00790062003300640038006200620077006500210041007000700000000405000000000000E40200004C0000000114020000000000C000000000000046830080002000000011FC3D3A9A5CD9014215403A9A5CD9015DEB657F475AD90186090000000000000100000000000000000000000000000052013A001F80C827341F105C1042AA032EE45287D668260001002600EFBE12000000053783FDB757D90127E55B24B857D90129BE3F3A9A5CD901140056003100000000007656454511005461736B42617200400009000400EFBE70563D1C765645452E00000049850100000001000000000000000000000000000000BA573F005400610073006B0042006100720000001600C0003200860900007356A64D20004D4943524F537E312E4C4E4B0000560009000400EFBE76564D4576564D452E000000AD25060000000D000000000000000000000000000000A3D88D004D006900630072006F0073006F0066007400200045006400670065002E006C006E006B0000001C00220000001E00EFBE02005500730065007200500069006E006E006500640000001C00120000002B00EFBE4215403A9A5CD9011C001A0000001D00EFBE02004D005300450064006700650000001C0000009B0000001C000000010000001C0000002D000000000000009A0000001100000003000000F3E6EE6A1000000000433A5C55736572735C6261735C417070446174615C526F616D696E675C4D6963726F736F66745C496E7465726E6574204578706C6F7265725C517569636B204C61756E63685C557365722050696E6E65645C5461736B4261725C4D6963726F736F667420456467652E6C6E6B000060000000030000A058000000000000006C6170746F70000000000000000000003C0F4E300424BB478D1C94F009EE61D336CDD1081DC8ED11BC204C796ED737593C0F4E300424BB478D1C94F009EE61D336CDD1081DC8ED11BC204C796ED7375945000000090000A03900000031535053B1166D44AD8D7048A748402EA43D788C1D000000680000000048000000D15C644BD685944F94138D6EB0EE6668000000000000000000000000" }
@{path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband"; name = "FavoritesChanges"; propertyType = "DWord"; data = 9 }
@{path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband"; name = "FavoritesVersion"; propertyType = "DWord"; data = 1 }
)
static [hashtable[]] $pinnedItems = @(
@{name = "Microsoft Edge"; path = "$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft Edge.lnk"; data = "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" }
@{name = "Directory Opus"; path = "$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Directory Opus.lnk"; data = "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" }
)
static [void] RestoreFiles() {
foreach ($pinnedItem in [Taskbar]::pinnedItems) {
Write-Host "[+++] Attempting to create '$($pinnedItem.name)' link" -ForegroundColor Yellow
[Utils]::WriteFile($pinnedItem.data, $pinnedItem.path)
}
}
static [void] RestoreRegistry() {
foreach ($registry in [Taskbar]::registry) {
If (!(Test-Path $registry.path)) {
New-Item -Path $registry.path -Force | Out-Null
}
Write-Host "[+++] Attempting to create '$('{0}\{1}' -f $registry.path, $registry.name)'" -ForegroundColor Yellow
switch ($registry.propertyType) {
'Binary' { New-ItemProperty -Path $($registry.path) -Name $($registry.name) -PropertyType "Binary" -Force -Value ([byte[]]([System.Convert]::FromHexString($registry.data))) }
'DWord' { New-ItemProperty -Path $($registry.path) -Name $($registry.name) -PropertyType "DWord" -Force -Value ([byte]($registry.data)) }
Default { New-ItemProperty -Path $registry.path -Name $registry.name -PropertyType $registry.propertyType -Force -Value ($registry.data) }
}
}
}
}
class DesktopIcons {
static [hashtable[]] $registry = @(
@{path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel"; displayName = "My Computer"; name = '{20D04FE0-3AEA-1069-A2D8-08002B30309D}'; propertyType = "DWord"; data = 0 }
@{path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel"; displayName = "Recycle bin"; name = '{645FF040-5081-101B-9F08-00AA002F954E}'; propertyType = "DWord"; data = 1 }
@{path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel"; displayName = "User's Files"; name = '{59031A47-3F72-44A7-89C5-5595FE6B30EE}'; propertyType = "DWord"; data = 1 }
@{path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel"; displayName = "OneDrive"; name = '{018D5C66-4533-4307-9B53-224DE2ED1FE6}'; propertyType = "DWord"; data = 1 }
)
static [void] RestoreRegistry() {
foreach ($registry in [DesktopIcons]::registry) {
If (!(Test-Path $registry.path)) {
New-Item -Path $registry.path -Force | Out-Null
}
Write-Host "[+++] Attempting to create '$('{0}\{1}' -f $registry.path, $registry.name)'" -ForegroundColor Yellow
switch ($registry.propertyType) {
'Binary' { New-ItemProperty -Path $($registry.path) -Name $($registry.name) -PropertyType "Binary" -Force -Value ([byte[]]([System.Convert]::FromHexString($registry.data))) }
'DWord' { New-ItemProperty -Path $($registry.path) -Name $($registry.name) -PropertyType "DWord" -Force -Value ([byte]($registry.data)) }
Default { New-ItemProperty -Path $registry.path -Name $registry.name -PropertyType $registry.propertyType -Force -Value ($registry.data) }
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment