#requires -version 5.1
<#
.SYNOPSIS
XBS Windows 10 Debloat & Privacy Script
.DESCRIPTION
Optimiert Windows 10 22H2 fuer einen datenschutzfreundlichen,
stabilen Business- und Produktiv-PC.
#>
[CmdletBinding(SupportsShouldProcess = $true)]
param(
[bool]$RemoveStore = $true,
[bool]$RemoveOneDrive = $true,
[bool]$RemoveXbox = $true,
[bool]$RemoveConsumerApps = $true,
[bool]$DisableTelemetry = $true,
[bool]$DisableTasks = $true,
[bool]$CleanTemp = $true,
[bool]$DisableBitLocker = $true
)
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Error "Dieses Skript muss als Administrator ausgefuehrt werden!"
Exit
}
$StatAppxRemoved = 0; $StatAppxNotFound = 0; $StatAppxSkipped = 0; $StatAppxError = 0
$StatProvRemoved = 0; $StatProvNotFound = 0; $StatProvError = 0
$StatSvcDisabled = 0; $StatSvcAlreadyDisabled = 0; $StatSvcError = 0
$StatTaskDisabled = 0; $StatTaskNotFound = 0; $StatTaskError = 0
$StoreStatus = "BEIBEHALTEN"
$OneDriveClient = "BEIBEHALTEN"; $OneDriveAutostart = "AKTIV"; $OneDriveExplorer = "AKTIV"; $OneDriveData = "NICHT GEPRUEFT"
$XboxRemovedCount = 0; $XboxSvcDisabledCount = 0
$PrivacyTelemetry = "NEIN"; $PrivacyAdvId = "NEIN"; $PrivacyConsumer = "NEIN"; $PrivacyFeedback = "NEIN"; $PrivacyActivity = "NEIN"
$CleanupTempStatus = "NICHT DURCHGEFUEHRT"
$Warnings = @()
$OSInfo = Get-ComputerInfo -Property OsName, OsDisplayVersion, OsBuildNumber, CsName, CsDomain
$ComputerName = $OSInfo.CsName
$WindowsEdition = $OSInfo.OsName
$WindowsVersion = $OSInfo.OsDisplayVersion
$WindowsBuild = $OSInfo.OsBuildNumber
$DomainName = $OSInfo.CsDomain
$SecureChannelStatus = "N/A"
if ($DomainName -and $DomainName -ne "WORKGROUP") {
try {
if (Test-ComputerSecureChannel -ErrorAction Stop) {
$SecureChannelStatus = "OK"
} else {
$SecureChannelStatus = "FEHLER"
$Warnings += "[WARN] Secure Channel zur Domaene ist unterbrochen."
$Warnings += "[INFO] Dies kann AppX-Abfragen mit -AllUsers beeinflussen."
}
} catch {
$SecureChannelStatus = "FEHLER"
}
} else {
$SecureChannelStatus = "NICHT IN DOMAENE"
}
$AppList = @()
$CapabilityList = @()
if ($RemoveStore) {
$AppList += @("Microsoft.WindowsStore", "Microsoft.StorePurchaseApp")
}
if ($RemoveXbox) {
$AppList += @("Microsoft.XboxApp", "Microsoft.XboxGamingOverlay", "Microsoft.XboxIdentityProvider", "Microsoft.XboxSpeechToTextOverlay", "Microsoft.GamingApp")
}
if ($RemoveConsumerApps) {
$AppList += @(
"Microsoft.549981C3F5F10", "Microsoft.BingNews", "Microsoft.BingWeather", "Microsoft.GetHelp",
"Microsoft.Getstarted", "Microsoft.MicrosoftSolitaireCollection", "Microsoft.Office.OneNote",
"Microsoft.People", "Microsoft.SkypeApp", "Microsoft.YourPhone", "Microsoft.ZuneMusic",
"Microsoft.ZuneVideo", "Microsoft.MixedReality.Portal", "Microsoft.ScreenSketch", "Clipchamp.Clipchamp"
)
$CapabilityList += @(
"Browser.InternetExplorer~~~~0.0.11.0", "Hello.Face.18967~~~~0.0.1.0",
"MathRecognizer~~~~0.0.1.0", "OneCore.OpenSSH.Client~~~~0.0.1.0"
)
}
foreach ($AppName in $AppList) {
$AppPackages = Get-AppxPackage -Name $AppName -AllUsers -ErrorAction SilentlyContinue
$ProvPackages = Get-AppxProvisionedPackage -Online | Where-Object {$_.DisplayName -eq $AppName}
if ($AppPackages) {
if ($PSCmdlet.ShouldProcess($AppName, "AppX Package entfernen")) {
try {
Get-AppxPackage -Name $AppName -AllUsers | Remove-AppxPackage -ErrorAction Stop
$StatAppxRemoved++
if ($AppName -like "*Xbox*") { $XboxRemovedCount++ }
if ($AppName -eq "Microsoft.WindowsStore") { $StoreStatus = "ENTFERNT" }
} catch { $StatAppxError++ }
} else { $StatAppxSkipped++ }
} else { $StatAppxNotFound++ }
if ($ProvPackages) {
if ($PSCmdlet.ShouldProcess($AppName, "Provisioned Package entfernen")) {
try {
Get-AppxProvisionedPackage -Online | Where-Object {$_.DisplayName -eq $AppName} | Remove-AppxProvisionedPackage -Online -ErrorAction Stop
$StatProvRemoved++
} catch { $StatProvError++ }
}
} else { $StatProvNotFound++ }
}
foreach ($Cap in $CapabilityList) {
if (Get-WindowsCapability -Online -Name $Cap | Where-Object {$_.State -eq "Installed"}) {
if ($PSCmdlet.ShouldProcess($Cap, "Windows Feature entfernen")) {
try { Remove-WindowsCapability -Online -Name $Cap -ErrorAction Stop } catch {}
}
}
}
if ($RemoveOneDrive) {
if ($PSCmdlet.ShouldProcess("OneDrive", "Deinstallation und Registry-Sperre")) {
Stop-Process -Name "OneDrive" -ErrorAction SilentlyContinue
$OSArchitecture = (Get-WmiObject Win32_OperatingSystem).OSArchitecture
$OneDriveInstaller = "$env:SystemRoot\System32\OneDriveSetup.exe"
if ($OSArchitecture -match "64") { $OneDriveInstaller = "$env:SystemRoot\SysWOW64\OneDriveSetup.exe" }
if (Test-Path $OneDriveInstaller) {
Start-Process $OneDriveInstaller -ArgumentList "/uninstall" -NoNewWindow -Wait
$OneDriveClient = "ENTFERNT"
} else { $OneDriveClient = "NICHT GEFUNDEN" }
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows" -Name "OneDrive" -Force -ErrorAction SilentlyContinue | Out-Null
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive" -Name "DisableFileSyncNGSC" -Type DWord -Value 1
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "OneDrive" -ErrorAction SilentlyContinue
$OneDriveAutostart = "DEAKTIVIERT"
$OneDriveExplorer = "ENTFERNT"
$OneDriveData = "NICHT GELÖSCHT"
}
}
if ($DisableTelemetry) {
if ($PSCmdlet.ShouldProcess("Registry", "Datenschutz optimieren")) {
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows" -Name "DataCollection" -Force -ErrorAction SilentlyContinue | Out-Null
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
$PrivacyTelemetry = "JA"
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Name "Enabled" -Type DWord -Value 0
$PrivacyAdvId = "JA"
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows" -Name "CloudContent" -Force -ErrorAction SilentlyContinue | Out-Null
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -Type DWord -Value 1
$PrivacyConsumer = "JA"
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" -Force -ErrorAction SilentlyContinue | Out-Null
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" -Name "PeriodInNanoSeconds" -Type DWord -Value 0
$PrivacyFeedback = "JA"
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows" -Name "System" -Force -ErrorAction SilentlyContinue | Out-Null
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "EnableActivityFeed" -Type DWord -Value 0
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "PublishUserActivities" -Type DWord -Value 0
$PrivacyActivity = "JA"
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -Type DWord -Value 0
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "CortanaConsent" -Type DWord -Value 0
}
}
if ($DisableTasks) {
$TasksToDisable = @(
"\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser",
"\Microsoft\Windows\Application Experience\ProgramDataUpdater",
"\Microsoft\Windows\Customer Experience Improvement Program\Consolidator",
"\Microsoft\Windows\Customer Experience Improvement Program\Usbceip"
)
foreach ($Task in $TasksToDisable) {
$TName = Split-Path $Task -Leaf
$TPath = Split-Path $Task
if (Get-ScheduledTask -TaskPath $TPath -TaskName $TName -ErrorAction SilentlyContinue) {
if ($PSCmdlet.ShouldProcess($Task, "Task deaktivieren")) {
try {
Disable-ScheduledTask -TaskName $TName -TaskPath $TPath -ErrorAction Stop | Out-Null
$StatTaskDisabled++
} catch { $StatTaskError++ }
}
} else { $StatTaskNotFound++ }
}
}
$ServicesToDisable = @("DiagTrack", "dmwappushservice")
if ($RemoveXbox) { $ServicesToDisable += @("XblAuthManager", "XblGameSave", "XboxNetApiSvc") }
foreach ($Svc in $ServicesToDisable) {
$ServiceObj = Get-Service -Name $Svc -ErrorAction SilentlyContinue
if ($ServiceObj) {
if ($ServiceObj.StartType -eq "Disabled") { $StatSvcAlreadyDisabled++ }
else {
if ($PSCmdlet.ShouldProcess($Svc, "Dienst deaktivieren")) {
try {
Stop-Service -Name $Svc -Force -ErrorAction SilentlyContinue
Set-Service -Name $Svc -StartupType Disabled -ErrorAction Stop
$StatSvcDisabled++
if ($Svc -like "*Xbox*") { $XboxSvcDisabledCount++ }
} catch { $StatSvcError++ }
}
}
} else { $StatSvcError++ }
}
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "LaunchTo" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 0
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Hidden" -Type DWord -Value 1
$C_DriveBL = "NICHT GEPRUEFT"; $OtherDriveBL = "NICHT GEPRUEFT"
try {
$BLVolumes = Get-BitLockerVolume -ErrorAction SilentlyContinue
if ($BLVolumes) {
$C_Vol = $BLVolumes | Where-Object {$_.MountPoint -eq "C:"}
if ($C_Vol) {
if ($C_Vol.VolumeStatus -eq "FullyEncrypted") {
if ($DisableBitLocker -and $PSCmdlet.ShouldProcess("C:", "BitLocker entschluesseln")) {
Disable-BitLocker -MountPoint "C:"
$C_DriveBL = "ENTSCHLUESSELUNG GESTARTET"
} else { $C_DriveBL = "VERSCHLUESSELT" }
} else { $C_DriveBL = "NICHT VERSCHLUESSELT" }
}
$Other_Vols = $BLVolumes | Where-Object {$_.MountPoint -ne "C:"}
if ($Other_Vols) {
if ($Other_Vols | Where-Object {$_.VolumeStatus -eq "FullyEncrypted"}) { $OtherDriveBL = "VERSCHLUESSELT" }
else { $OtherDriveBL = "NICHT VERSCHLUESSELT" }
} else { $OtherDriveBL = "KEINE WEITEREN LAUFWERKE" }
} else {
$C_DriveBL = "NICHT VERSCHLUESSELT"
$OtherDriveBL = "NICHT VERSCHLUESSELT"
}
} catch { $C_DriveBL = "FEHLER BEIM AUSLESEN" }
if ($CleanTemp) {
if ($PSCmdlet.ShouldProcess("Temp-Ordner", "Inhalt loeschen")) {
$TempPaths = @("$env:TEMP\*", "$env:SystemRoot\Temp\*")
foreach ($Path in $TempPaths) {
Remove-Item -Path $Path -Recurse -Force -ErrorAction SilentlyContinue
}
$CleanupTempStatus = "DURCHGEFUEHRT"
}
}
Clear-Host
$DisplayDomain = if ([string]::IsNullOrEmpty($DomainName)) { "KEINE" } else { $DomainName }
Write-Output "============================================================"
Write-Output " XBS WINDOWS 10 DEBLOAT v2.1"
Write-Output " ABSCHLUSSBERICHT"
Write-Output "============================================================"
Write-Output ""
Write-Output "SYSTEM"
Write-Output "------------------------------------------------------------"
Write-Output ("Computername : " + $ComputerName)
Write-Output ("Windows : " + $WindowsEdition)
Write-Output ("Version : " + $WindowsVersion)
Write-Output ("Build : " + $WindowsBuild)
Write-Output ("Domaene : " + $DisplayDomain)
Write-Output ("Secure Channel : " + $SecureChannelStatus)
Write-Output ""
Write-Output "APPX / WINDOWS-APPS"
Write-Output "------------------------------------------------------------"
Write-Output ("Entfernt : " + $StatAppxRemoved)
Write-Output ("Bereits nicht vorhanden : " + $StatAppxNotFound)
Write-Output ("Uebersprungen : " + $StatAppxSkipped)
Write-Output ("Fehler : " + $StatAppxError)
Write-Output ""
Write-Output "PROVISIONIERTE APPS"
Write-Output "------------------------------------------------------------"
Write-Output ("Entfernt : " + $StatProvRemoved)
Write-Output ("Bereits nicht vorhanden : " + $StatProvNotFound)
Write-Output ("Fehler : " + $StatProvError)
Write-Output ""
Write-Output "MICROSOFT STORE"
Write-Output "------------------------------------------------------------"
Write-Output ("Status : " + $StoreStatus)
Write-Output ""
Write-Output "ONEDRIVE"
Write-Output "------------------------------------------------------------"
Write-Output ("Client : " + $OneDriveClient)
Write-Output ("Autostart : " + $OneDriveAutostart)
Write-Output ("Explorer-Integration : " + $OneDriveExplorer)
Write-Output ("Benutzerdaten : " + $OneDriveData)
Write-Output ""
Write-Output "XBOX / GAMING"
Write-Output "------------------------------------------------------------"
Write-Output ("Entfernt : " + $XboxRemovedCount)
Write-Output ("Dienste deaktiviert : " + $XboxSvcDisabledCount)
Write-Output ""
Write-Output "DATENSCHUTZ"
Write-Output "------------------------------------------------------------"
Write-Output ("Telemetrie reduziert : " + $PrivacyTelemetry)
Write-Output ("Werbe-ID deaktiviert : " + $PrivacyAdvId)
Write-Output ("Consumer Features deaktiviert : " + $PrivacyConsumer)
Write-Output ("Feedback reduziert : " + $PrivacyFeedback)
Write-Output ("Aktivitaetsverlauf reduziert : " + $PrivacyActivity)
Write-Output ""
Write-Output "DIENSTE"
Write-Output "------------------------------------------------------------"
Write-Output ("Deaktiviert : " + $StatSvcDisabled)
Write-Output ("Bereits deaktiviert : " + $StatSvcAlreadyDisabled)
Write-Output ("Fehler : " + $StatSvcError)
Write-Output ""
Write-Output "GEPLANTE AUFGABEN"
Write-Output "------------------------------------------------------------"
Write-Output ("Deaktiviert : " + $StatTaskDisabled)
Write-Output ("Nicht gefunden : " + $StatTaskNotFound)
Write-Output ("Fehler : " + $StatTaskError)
Write-Output ""
Write-Output "BITLOCKER"
Write-Output "------------------------------------------------------------"
Write-Output ("OS-Laufwerk : " + $C_DriveBL)
Write-Output ("Weitere Laufwerke : " + $OtherDriveBL)
Write-Output ""
Write-Output "BEREINIGUNG"
Write-Output "------------------------------------------------------------"
Write-Output ("Temporaere Dateien : " + $CleanupTempStatus)
Write-Output ""
Write-Output "FEHLER / HINWEISE"
Write-Output "------------------------------------------------------------"
if ($Warnings.Count -gt 0) {
foreach ($Warn in $Warnings) { Write-Output $Warn }
} else {
Write-Output "Keine Fehler oder kritischen Hinweise."
}
Write-Output ""
Write-Output "============================================================"
Write-Output "ERGEBNIS"
Write-Output "============================================================"
Write-Output ""
Write-Output "✓ Debloat erfolgreich abgeschlossen."
if ($Warnings.Count -gt 0) {
Write-Output ""
Write-Output ("⚠ " + ($Warnings.Count / 2) + " WARNUNG(EN)")
Write-Output ""
Write-Output "Domaenvertrauensstellung reparieren:"
Write-Output "Test-ComputerSecureChannel -Repair -Credential (Get-Credential)"
}
Write-Output ""
Write-Output "Neustart erforderlich: JA"
Write-Output ""
Write-Output "============================================================"
Write-Output " XBS – WINDOWS 10 DEBLOAT v2.1"
Write-Output "============================================================"