WINDOWS 8.1 DEBLOATER+ ▀ POWERSHELL SCRIPT TO FULLY CLEAN WINDOWS 8.1 FROM BLOAT AND TELEMETRY

WINDOWS 8.1 DEBLOATER+ ▀ POWERSHELL SCRIPT TO FULLY CLEAN WINDOWS 8.1 FROM BLOAT AND TELEMETRY

Note that this is ALPHA, test it in VM please, drop your suggestions at [Github] !

Windows 7 Premium Assurance is coming to an end in January 2026, so i’m considering Windows 8.1 migration.
That is why i have decided to make an ultimate debloating script for Windows 8.1, which will be supported until October 2026.

Ok, some preface words to clean things up a bit. I’ve done this configuration for my personal specific needs.
But there is a slim chance that somebody will find it useful too. Aimed for desktop and laptops, not tablets.

Script is based upon Windows 8.1 Debloater:
https://github.com/teeotsa/windows-8-debloat

Original functionality:

  • disable some of the bloat services
  • disable telemetry, scheduled crap tasks and Defender
  • disable autologger

What’s new:

  • implemented substantially more comprehensive services management
  • high risk infection SMB1 is disabled to minimize attack vector
  • AppX Metro packages removed [because i don’t like them]
  • applied some tweaks here and there
  • added probably unneeded GUI niceties
SO WHAT WE ARE NOT DOING:

  • No Prefech since we are on NVME
  • No WiFi, Bluetooth or any wireless connection
  • No GPS location services
  • No LAN snares, no SMB, UPnP/SSDP, WebDAV, SNMP, ICS, streaming, Home groups, Telnet & remote access
  • No printing and scanning
  • No apple thingies so no Bonjour
  • We are not using Edge browser
  • We don’t care about logging & diagnostics either
  • Also we are not using default windows search
  • Since OS is already out of support no Windows Update and BITS [how convenient]
  • Only one user, no secondary logon
IN THE END OF THE DAY WE ARE ONLY SURFING THE WEB AND DO AUDIO AND GFX!


STOPPED AND DISABLED SERIVES SORTED BY CATEGORY

REMOTE

  • Remote Desktop Configuration (SessionEnv)
  • Remote Desktop Services (TermService)
  • Remote Desktop Services UserMode Port Redirector (UmRdpService)
  • Remote Registry (RemoteRegistry)
  • Routing and Remote Access (RemoteAccess)
  • Windows Remote Management (WS-Management) (WinRM)

NETWORK

  • Application Layer Gateway Service (ALG)
  • BranchCache (PeerDistSvc)
  • Certificate Propagation (CertPropSvc)
  • Client for NFS (NfsClnt)
  • Computer Browser (Browser)
  • Function Discovery Provider Host (fdPHost)
  • Function Discovery Resource Publication (FDResPub)
  • HomeGroupListener (HomeGroupListener)
  • HomeGroupProvider (HomeGroupProvider)
  • Internet Connection Sharing (SharedAccess)
  • Link-Layer Topology Discovery Mapper (lltdsvc)
  • Microsoft Edge Update Service (edgeupdate)
  • Microsoft Edge Update Service (edgeupdatem)
  • MicrosoftEdgeElevationService (MicrosoftEdgeElevationService)
  • Net.Tcp Port Sharing Service (NetTcpPortSharing)
  • Netlogon (Netlogon)
  • Network Access Protection Agent (napagent)
  • Offline Files (CscService)
  • Peer Name Resolution Protocol (PNRPsvc)
  • Peer Networking Grouping (p2psvc)
  • Peer Networking Identity Manager (p2pimsvc)
  • PNRP Machine Name Publication Service (PNRPAutoReg)
  • Quality Windows Audio Video Experience (QWAVE)
  • Remote Procedure Call (RPC) Locator (RpcLocator)
  • Server (LanmanServer)
  • SNMP Service (SNMP)
  • SNMP Trap (SNMPTRAP)
  • SSDP Discovery (SSDPSRV)
  • TCP/IP NetBIOS Helper (lmhosts)
  • Telephony (TapiSrv)
  • Telnet (TlntSvr)
  • UPnP Device Host (upnphost)
  • WebClient (WebClient)
  • Windows Connect Now-Config Registrar (wcncsvc)
  • Windows Media Player Network Sharing Service (WMPNetworkSvc)
  • Windows Store Service (WSService)
  • WinHTTP Web Proxy Auto-Discovery Service (WinHttpAutoProxySvc)
  • WMI Performance Adapter (wmiApSrv)
  • Work Folders (workfolderssvc)
  • Workstation (LanmanWorkstation)
  • WWAN AutoConfig (WwanSvc)

WIRELESS

  • Bluetooth Support Service (bthserv)
  • Bluetooth Handsfree Service (BthHFSrv)
  • Fax (Fax)
  • WLAN AutoConfig (WlanSvc)

LOGGING

  • Diagnostic Policy Service (DPS)
  • Diagnostic Service Host (WdiServiceHost)
  • Diagnostic System Host (WdiSystemHost)
  • Diagnostics Tracking Service (DiagTrack)
  • Family Safety (WPCSvc)
  • File History Service (fhsvc)
  • Internet Explorer ETW Collector Service (IEEtwCollectorService)
  • Microsoft Account Sign-in Assistant (wlidsvc)
  • Performance Counter DLL Host (PerfHost)
  • Performance Logs & Alerts (pla)
  • Problem Reports and Solutions Control Panel Support (wercplsupport)
  • Sensor Monitoring Service (SensrSvc)
  • Smart Card (SCardSvr)
  • Smart Card Device Enumeration Service (ScDeviceEnum)
  • Smart Card Removal Policy (SCPolicySvc)
  • Windows Biometric Service (WbioSrvc)
  • Windows Location Framework Service (lfsvc)

HYPER-V

  • Hyper-V Data Exchange Service (vmickvpexchange)
  • Hyper-V Guest Shutdown Service (vmicshutdown)
  • Hyper-V Guest Service Interface (vmicguestinterface)
  • Hyper-V Heartbeat Service (vmicheartbeat)
  • Hyper-V Remote Desktop Virtualization Service (vmicrdv)
  • Hyper-V Time Synchronization Service (vmictimesync)
  • Hyper-V Volume Shadow Copy Requestor (vmicvss)

UPDATE

  • Background Intelligent Transfer Service (BITS)
  • Windows Update (wuauserv)

DEVICES

  • Bonjour (mDNSResponder)
  • Microsoft iSCSI Initiator Service (MSiSCSI)
  • Microsoft Keyboard Filter (MsKeyboardFilter)
  • Microsoft Storage Spaces SMP (smphost)
  • Print Spooler (Spooler)
  • Printer Extensions and Notifications (PrintNotify)
  • Still Image Acquisition Events (WiaRpc)
  • Touch Keyboard and Handwriting Panel Service (TabletInputService)
  • Windows Image Acquisition (StiSvc)

SYSTEM

  • ActiveX Installer (AxInstSV)
  • Application Host Helper Service (AppHostSvc)
  • Application Identity (AppIDSvc)
  • Application Management (AppMgmt)
  • AppX Deployment Service (AppXSvc)
  • ASP.NET State Service (aspnet_state)
  • BitLocker Drive Encryption Service (BDESVC)
  • Block Level Backup Engine Service (wbengine)
  • Distributed Link Tracking Client (TrkWks)
  • Encrypting File System (EFS) (EFS)
  • Health Key and Certificate Management (hkmsvc)
  • Optimize drives (defragsvc)
  • Secondary Logon (seclogon)
  • Security Center (wscsvc)
  • Storage Service (StorSvc)
  • Superfetch (SysMain)
  • Windows Defender Network Inspection Service (WdNisSvc)
  • Windows Defender Service (WinDefend)
  • Windows Search (WSearch)

RUNNING AND HAVE AUTO START-UP STATUS

  • Background Tasks Infrastructure Service (BrokerInfrastructure)
  • COM+ Event System (EventSystem)
  • Cryptographic Services (CryptSvc)
  • DCOM Server Process Launcher (DcomLaunch)
  • DHCP Client (Dhcp)
  • DNS Client (Dnscache)
  • Group Policy Client (gpsvc)
  • Human Interface Device Access (hidserv)
  • IKE and AuthIP IPsec Keying Modules (IKEEXT)
  • IPsec Policy Agent (PolicyAgent)
  • Local Session Manager (LSM)
  • Multimedia Class Scheduler (MMCSS)
  • Network List Service (netprofm)
  • Network Location Awareness (NlaSvc)
  • Network Store Interface Service (nsi)
  • Plug and Play (PlugPlay)
  • Power (Power)
  • Remote Procedure Call RPC (RpcSs)
  • RPC Endpoint Mapper (RpcEptMapper)
  • Security Accounts Manager (SamSs)
  • System Event Notification Service (SENS)
  • System Events Broker (SystemEventsBroker)
  • Task Scheduler (Schedule)
  • Themes (Themes)
  • User Profile Service (ProfSvc)
  • Windows Audio (AudioSrv)
  • Windows Audio Endpoint Builder (AudioEndpointBuilder)
  • Windows Connection Manager (Wcmsvc)
  • Windows Firewall (MpsSvc)
  • Windows Font Cache Service (FontCache)
  • Windows Management Instrumentation (Winmgmt)

RUNNING AND HAVE MANUAL START-UP STATUS

  • Base Filtering Engine (BFE)
  • Device Install Service (DeviceInstall)
  • Device Setup Manager (DsmSvc)
  • Program Compatibility Assistant Service (PcaSvc)

STOPPED AND HAVE AUTO START-UP STATUS

  • Software Protection (sppsvc)
  • Windows Event Log (EventLog)

STOPPED AND HAVE MANUAL START-UP STATUS

  • App Readiness (AppReadiness)
  • Application Experience (AeLookupSvc)
  • Application Information (Appinfo)
  • CNG Key Isolation (KeyIso)
  • COM+ System Application (COMSysApp)
  • Credential Manager (VaultSvc)
  • Device Association Service (DeviceAssociationService)
  • Distributed Transaction Coordinator (MSDTC)
  • Extensible Authentication Protocol (Eaphost)
  • Interactive Services Detection (UI0Detect)
  • IP Helper (iphlpsvc)
  • KtmRm for Distributed Transaction Coordinator (KtmRm)
  • Microsoft Software Shadow Copy Provider (swprv)
  • Network Connected Devices Auto-Setup (NcdAutoSetup)
  • Network Connection Broker (NcbService)
  • Network Connections (Netman)
  • Network Connectivity Assistant (NcaSvc)
  • Portable Device Enumerator Service (WPDBusEnum)
  • Remote Access Auto Connection Manager (RasAuto)
  • Remote Access Connection Manager (RasMan)
  • Secure Socket Tunneling Protocol Service (SstpSvc)
  • Shell Hardware Detection (ShellHWDetection)
  • Spot Verifier (svsvc)
  • Thread Ordering Server (THREADORDER)
  • Time Broker (TimeBroker)
  • Virtual Disk (vds)
  • Volume Shadow Copy (VSS)
  • Windows Color System (WcsPlugInService)
  • Windows Driver Foundation - User-mode Driver Framework (wudfsvc)
  • Windows Encryption Provider Host Service (WEPHOSTSVC)
  • Windows Error Reporting Service (WerSvc)
  • Windows Event Collector (Wecsvc)
  • Windows Installer (msiserver)
  • Windows Modules Installer (TrustedInstaller)
  • Windows Presentation Foundation Font Cache 3.0.0.0 (FontCache3.0.0.0)
  • Windows Time (W32Time)
  • Wired AutoConfig (dot3svc)
SOURCE CODE OF THE SCRIPT
<#
Windows 8.1 Debloater + [2025]

Script is based upon Windows 8.1 Debloater: https://github.com/teeotsa/windows-8-debloat

Original functionality:
- disable some of the bloat services
- disable telemetry, scheduled crap tasks and Defender
- disable autologger

Read windows-8-1-debloater+.txt for more explanation.

Compiled by TrackerNinja aka spacedrone808:
https://trackerninja.codeberg.page

What's new:
- implemented substantially more comprehensive services management 
- high risk infection SMB1 is disabled to minimize attack vector 
- AppX Metro packages removed [because i don't like them]
- applied some tweaks here and there
- added probably unneeded GUI niceties

#>


$host.UI.RawUI.BackgroundColor = 'Black'
Clear-Host 

Write-Host "Welcome to Windows 8.1 Debloater+ [2025]`n" -ForegroundColor White

Write-Host "Script is based upon Windows 8.1 Debloater: 
https://github.com/teeotsa/windows-8-debloat
Compiled by TrackerNinja aka spacedrone808.

Original functionality:
- disable some of the bloat services
- disable telemetry, scheduled crap tasks and Defender
- disable autologger

What's new:
- implemented substantially more comprehensive services management 
- high risk infection SMB1 is disabled to minimize attack vector 
- AppX Metro packages removed [because i don't like them]
- applied some tweaks here and there
- added probably unneeded GUI niceties

Read windows-8-1-debloater+.txt for more explanation.

`n" -ForegroundColor Red
Write-Host "https://trackerninja.codeberg.page`n" -ForegroundColor White

#Requires -RunAsAdministrator

Add-Type -AssemblyName System.Windows.Forms

# Initial confirmation GUI
$result = [System.Windows.Forms.MessageBox]::Show("We are going to change your services configuration [by a big margin], remove AppX Packages, disable SMB1 protocol, disable telemetry, crap tasks and Defender, disable autologger, apply some tweaks here and there and do some other dirty hacking, math & science. Do you allow to do such things to your puter?", "User request for science and magic", [System.Windows.Forms.MessageBoxButtons]::YesNo, [System.Windows.Forms.MessageBoxIcon]::Question)
if ($result -ne [System.Windows.Forms.DialogResult]::Yes) {
    exit
}


Write-Host "Starting to dump bloat services...`n" -ForegroundColor Green

# Services to disable and stop
$disabledServices = @(
    "RemoteRegistry", "RemoteAccess", "WinRM", "TermService", "SessionEnv", "UmRdpService",
    "SSDPSRV", "WMPNetworkSvc", "p2psvc", "p2pimsvc", "PeerDistSvc", "PNRPsvc", "HomeGroupListener", "HomeGroupProvider", "upnphost", "fdPHost", "FDResPub", "SNMP", "SNMPTRAP", "lmhosts", "TlntSvr", "SharedAccess", "LanmanWorkstation", "LanmanServer", "wcncsvc", "RpcLocator", "CscService", "napagent", "Netlogon", "NfsClnt", "CertPropSvc", "WebClient", "TapiSrv", "Browser", "NetTcpPortSharing", "lltdsvc", "edgeupdate", "edgeupdatem", "MicrosoftEdgeElevationService", "QWAVE", "WwanSvc", "workfolderssvc", "wmiApSrv", "WSService", "ALG", "WinHttpAutoProxySvc", "PNRPAutoReg",
    "bthserv", "BthHFSrv", "WlanSvc", "Fax",
    "WbioSrvc", "lfsvc", "SCPolicySvc", "ScDeviceEnum", "SensrSvc", "IEEtwCollectorService", "WPCSvc", "SCardSvr", "wlidsvc", "fhsvc", "wercplsupport", "DPS", "WdiServiceHost", "WdiSystemHost", "DiagTrack", "PerfHost", "pla",
    "vmicvss", "vmictimesync", "vmicrdv", "vmicheartbeat", "vmicshutdown", "vmicguestinterface", "vmickvpexchange",
    "wuauserv", "BITS",
    "TabletInputService", "Spooler", "PrintNotify", "mDNSResponder", "WiaRpc", "StiSvc", "MSiSCSI", "MsKeyboardFilter", "smphost",
    "wscsvc", "aspnet_state", "AxInstSV", "WSearch", "AppXSvc", "AppMgmt", "TrkWks", "seclogon", "SysMain", "StorSvc", "hkmsvc", "AppIDSvc", "BDESVC", "wbengine", "EFS", "WdNisSvc", "WinDefend", "AppHostSvc", "defragsvc"
)

foreach ($service in $disabledServices) {
    Set-Service -Name $service -StartupType Disabled -ErrorAction SilentlyContinue
    Stop-Service -Name $service -Force -ErrorAction SilentlyContinue
}

# Services to set auto and ensure running
$autoRunningServices = @(
    "RpcSs", "RpcEptMapper", "CryptSvc", "PolicyAgent", "SamSs", "IKEEXT", "Winmgmt", "ProfSvc", "Schedule", "SystemEventsBroker", "BrokerInfrastructure", "PlugPlay", "AudioSrv", "AudioEndpointBuilder", "MMCSS", "hidserv", "Themes", "Power", "EventSystem", "DcomLaunch", "SENS", "Dhcp", "Dnscache", "Wcmsvc", "gpsvc", "nsi", "LSM", "NlaSvc", "netprofm", "FontCache", "MpsSvc"
)

foreach ($service in $autoRunningServices) {
    Set-Service -Name $service -StartupType Automatic -ErrorAction SilentlyContinue
    Start-Service -Name $service -ErrorAction SilentlyContinue
}

# Services to set manual and ensure running
$manualRunningServices = @(
    "BFE", "PcaSvc", "DeviceInstall", "DsmSvc"
)

foreach ($service in $manualRunningServices) {
    Set-Service -Name $service -StartupType Manual -ErrorAction SilentlyContinue
    Start-Service -Name $service -ErrorAction SilentlyContinue
}

# Services to set auto and ensure stopped
$autoStoppedServices = @(
    "EventLog", "sppsvc"
)

foreach ($service in $autoStoppedServices) {
    Set-Service -Name $service -StartupType Automatic -ErrorAction SilentlyContinue
    Stop-Service -Name $service -Force -ErrorAction SilentlyContinue
}

# Services to set manual and ensure stopped
$manualStoppedServices = @(
    "Netman", "AppReadiness", "AeLookupSvc", "Eaphost", "VaultSvc", "MSDTC", "ShellHWDetection", "NcaSvc", "COMSysApp", "KeyIso", "Appinfo", "DeviceAssociationService", "msiserver", "TrustedInstaller", "SstpSvc", "W32Time", "iphlpsvc", "FontCache3.0.0.0", "WerSvc", "Wecsvc", "UI0Detect", "KtmRm", "WPDBusEnum", "swprv", "dot3svc", "RasMan", "RasAuto", "svsvc", "THREADORDER", "TimeBroker", "vds", "WcsPlugInService", "VSS", "wudfsvc", "WEPHOSTSVC", "NcbService", "NcdAutoSetup"
)

foreach ($service in $manualStoppedServices) {
    Set-Service -Name $service -StartupType Manual -ErrorAction SilentlyContinue
    Stop-Service -Name $service -Force -ErrorAction SilentlyContinue
}

Clear-Host 

# Services disabled
Write-Host "Bloat services were disabled!`n" -ForegroundColor Green

# Disable SMB1
Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol -NoRestart -ErrorAction SilentlyContinue

Write-Host "SMB1 is removed, attack vector minimized!`n" -ForegroundColor Green

# Removing AppX Packages
Write-Host 'Removing AppX Metro packages...'
$Job = Start-Job -ScriptBlock {
    Get-AppxPackage -AllUsers | Remove-AppxPackage
    Get-ProvisionedAppxPackage -Online | Remove-ProvisionedAppxPackage -Online
}
Wait-Job -Id $Job.Id | Out-Null
Write-Host "Done with AppX Metro packages!`n" -ForegroundColor Green

# Disable Telemetry
Write-Host 'Disabling telemetry and personal data collection...'
$Job = Start-Job -ScriptBlock {
    @("HKLM:\SOFTWARE\Policies\Microsoft\SQMClient", "HKLM:\SOFTWARE\Policies\Microsoft\SQMClient\Windows", "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent", "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection", "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection", "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection") | ForEach-Object {
        If (!(Test-Path $_))
        {
            New-Item -Path $_ -Force | Out-Null
        }
    }
    Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection' -Name 'AllowTelemetry' -Value 0 -Force -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection' -Name 'MaxTelemetryAllowed' -Value 0 -Force -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection' -Name 'AllowTelemetry' -Value 0 -Force -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection' -Name 'MaxTelemetryAllowed' -Value 0 -Force -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection' -Name 'AllowTelemetry' -Value 0 -Force -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection' -Name 'AllowTelemetry' -Value 0 -Force -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection' -Name 'DoNotShowFeedbackNotifications' -Value 0 -Force -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent' -Name 'DisableWindowsConsumerFeatures' -Value 1 -Force -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent' -Name 'DisableTailoredExperiencesWithDiagnosticData' -Value 1 -Force-ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Policies\Microsoft\SQMClient\Windows' -Name 'CEIPEnable' -Value 0 -Force -ErrorAction SilentlyContinue | Out-Null
}
Wait-Job -Id $Job.Id | Out-Null
Write-Host "Telemetry should be disabled for now!`n" -ForegroundColor Green

# Disable Windows Error Reporting
Write-Host 'Disabling Windows Error Reporting...'
$Job = Start-Job -ScriptBlock {
    $Service = Get-Service | ?{$_.DisplayName -match 'Windows Error Reporting'}
    $Service.Stop() | Out-Null
    Remove-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting' -Force -Recurse -ErrorAction SilentlyContinue | Out-Null
    New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting' -Force | Out-Null
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting' -Name 'Disabled' -Value 1 -Force -ErrorAction SilentlyContinue | Out-Null
    Set-Service -Name $Service.Name -StartupType Disabled | Out-Null
    Get-ChildItem -Path "$env:ProgramData\Microsoft\Windows\WER" -Force -Recurse | %{ Remove-Item -Path $_.FullName -Force -Recurse | Out-Null }
}
Wait-Job -Id $Job.Id | Out-Null
Write-Host "Windows Error Reporting is disabled!`n" -ForegroundColor Green

# Disable Scheduled Tasks
Write-Host 'Disabling Scheduled Tasks...'
$Job = Start-Job -ScriptBlock {
    $Paths = @(
        '\Microsoft\Windows\.NET Framework'
        '\Microsoft\Windows\Active Directory Rights Management Services Client'
        '\Microsoft\Windows\AppID'
        '\Microsoft\Windows\Application Experience'
        '\Microsoft\Windows\ApplicationData'
        '\Microsoft\Windows\AppxDeploymentClient'
        '\Microsoft\Windows\Autochk'
        '\Microsoft\Windows\Chkdsk'
        '\Microsoft\Windows\Customer Experience Improvement Program'
        '\Microsoft\Windows\Data Integrity Scan'
        '\Microsoft\Windows\Defrag'
        '\Microsoft\Windows\Device Setup'
        '\Microsoft\Windows\Diagnosis'
        '\Microsoft\Windows\DiskCleanup'
        '\Microsoft\Windows\DiskDiagnostic'
        '\Microsoft\Windows\DiskFootprint'
        '\Microsoft\Windows\DiskFootprint'
        '\Microsoft\Windows\FileHistory'
        '\Microsoft\Windows\IME'
        '\Microsoft\Windows\Location'
        '\Microsoft\Windows\Maintenance'
        '\Microsoft\Windows\MemoryDiagnostic'
        '\Microsoft\Windows\Mobile Broadband Accounts'
        '\Microsoft\Windows\PerfTrack'
        '\Microsoft\Windows\Offline Files'
        '\Microsoft\Windows\PI'
        '\Microsoft\Windows\Power Efficiency Diagnostics'
        '\Microsoft\Windows\RAC'
        '\Microsoft\Windows\RecoveryEnvironment'
        '\Microsoft\Windows\Registry'
        '\Microsoft\Windows\Servicing'
        '\Microsoft\Windows\SettingSync'
        '\Microsoft\Windows\SkyDrive'
        '\Microsoft\Windows\SoftwareProtectionPlatform'
        '\Microsoft\Windows\SpacePort'
        '\Microsoft\Windows\Sysmain'
        '\Microsoft\Windows\SystemRestore'
        '\Microsoft\Windows\TextServicesFramework'
        '\Microsoft\Windows\Time Synchronization'
        '\Microsoft\Windows\TPM'
        '\Microsoft\Windows\User Profile Service'
        '\Microsoft\Windows\WDI'
        '\Microsoft\Windows\Windows Defender'
        '\Microsoft\Windows\Windows Error Reporting'
        '\Microsoft\Windows\Windows Filtering Platform'
        '\Microsoft\Windows\Windows Media Sharing'
        '\Microsoft\Windows\WindowsColorSystem'
        '\Microsoft\Windows\WindowsUpdate'
        '\Microsoft\Windows\WOF'
        '\Microsoft\Windows\Work Folders'
        '\Microsoft\Windows\Workplace Join'
        '\Microsoft\Windows\WS'
    )
    Foreach ($TaskRoot in $Paths)
    {
        Get-ScheduledTask -TaskPath (-join($TaskRoot,'\')) | %{
            $FullPath = -join($_.TaskPath, '', $_.TaskName)
            Disable-ScheduledTask -TaskName "$FullPath" | Out-Null
        }
    }
}
Wait-Job -Id $Job.Id | Out-Null
Write-Host "Scheduled Tasks disabled!`n" -ForegroundColor Green

# Explorer Tweaks
Write-Host 'Applying Explorer Tweaks...'
$Job = Start-Job -ScriptBlock {
    # HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects
    Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects' -Name 'VisualFXSetting' -Value 3

    # HKCU:\Control Panel\Desktop
    Set-ItemProperty -Path 'HKCU:\Control Panel\Desktop' -Name 'UserPreferencesMask' -Value ([Byte[]](0x90,0x12,0x03,0x80,0x10,0x00,0x00,0x00))
    Set-ItemProperty -Path 'HKCU:\Control Panel\Desktop' -Name 'DragFullWindows' -Value 3
    Set-ItemProperty -Path 'HKCU:\Control Panel\Desktop' -Name 'FontSmoothing' -Value 2
    
    # HKCU:\Control Panel\Desktop\WindowMetrics
    Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects' -Name 'MinAnimate' -Value 0
    
    # HKCU:\Software\Microsoft\Windows\DWM
    Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects' -Name 'EnableAeroPeek' -Value 0
    Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects' -Name 'AlwaysHibernateThumbnails' -Value 0

    # HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced
    Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'ShowInfoTip' -Value 0
    Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'ShowStatusBar' -Value 0
    Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'StoreAppsOnTaskba' -Value 0
    Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'ListviewShadow' -Value 0
    Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'TaskbarAnimations' -Value 0
    Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'IconsOnly' -Value 1
    Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'ListviewAlphaSelect' -Value 1

    # HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects
    Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\AnimateMinMax' -Name 'DefaultApplied' -Value 0
    Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\ComboBoxAnimation' -Name 'DefaultApplied' -Value 0
    Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\ControlAnimations' -Name 'DefaultApplied' -Value 0
    Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\CursorShadow' -Name 'DefaultApplied' -Value 0
    Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\DropShadow' -Name 'DefaultApplied' -Value 0
    Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\DWMAeroPeekEnabled' -Name 'DefaultApplied' -Value 0
    Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\ListviewShadow' -Name 'DefaultApplied' -Value 0
    Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\MenuAnimation' -Name 'DefaultApplied' -Value 0

    # HKCU:\Control Panel\Accessibility\StickyKeys
    Set-ItemProperty -Path 'HKCU:\Control Panel\Accessibility\StickyKeys' -Name 'Flags' -Value 2

    # HKCU:\Control Panel\Mouse
    Set-ItemProperty -Path 'HKCU:\Control Panel\Mouse' -Name 'MouseSpeed' -Value 0
    Set-ItemProperty -Path 'HKCU:\Control Panel\Mouse' -Name 'MouseThreshold1' -Value 0
    Set-ItemProperty -Path 'HKCU:\Control Panel\Mouse' -Name 'MouseThreshold2' -Value 0

    # Restart Explorer
    Stop-Process -Name 'explorer' | Out-Null
}
Wait-Job -Id $Job.Id | Out-Null
Write-Host "Explorer Tweaks applied!`n" -ForegroundColor Green

# Disable Windows Defender
Write-Host 'Disabling Windows Defender...'
$Job = Start-Job -ScriptBlock {
    Try
    {
        # Enable TLS 1.2 Capabilities
        [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12  
        $WebClient = New-Object System.Net.WebClient
        $Link = 'https://github.com/M2Team/NSudo/releases/download/8.2/NSudo_8.2_All_Components.zip'

        # Path
        $ArchiveSavePath = [System.IO.Path]::Combine($env:TEMP, $Link.Substring($Link.LastIndexOf('/') + 1))
        $ExpandPath = [System.IO.Path]::Combine($env:TEMP, 'NSudo_Expand')
        $NSudoLauncher = [System.IO.Path]::Combine($ExpandPath, 'NSudo Launcher', 'Win32', 'NSudoLG.exe')

        # Download
        If (!(Test-Path $ArchiveSavePath))
        {
            $WebClient.DownloadFile($Link, $ArchiveSavePath)
        }

        # Expand
        If (!(Test-Path $ExpandPath))
        {
            Expand-Archive -Path $ArchiveSavePath -DestinationPath $ExpandPath -Force | Out-Null
        }

        # Launch
        Start-Process -FilePath "$NSudoLauncher" -ArgumentList '-U:T -P:E -ShowWindowMode:Hide cmd /c sc config WinDefend start= disabled>nul' -Verb RunAs -Wait -WindowStyle Hidden
        Start-Process -FilePath "$NSudoLauncher" -ArgumentList '-U:T -P:E -ShowWindowMode:Hide cmd /c sc config WdNisSvc start= disabled>nul' -Verb RunAs -Wait -WindowStyle Hidden

        # Remove Files
        Remove-Item -Path $ArchiveSavePath -Force -Recurse | Out-Null
        Remove-Item -Path $ExpandPath -Force -Recurse | Out-Null
    }
    Catch
    {
        Exit
    }
}
Wait-Job -Id $Job.Id | Out-Null
Write-Host "Windows Defender is ditched!`n" -ForegroundColor Green

# Disable Logs
Write-Host 'Disabling Logging...'
$Job = Start-Job -ScriptBlock {
    Get-ChildItem -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\WMI\Autologger' | %{
        $Name = $_.Name.Replace('HKEY_LOCAL_MACHINE','HKLM:')
        Set-ItemProperty -Path $Name -Name 'Start' -Value 4 -Force -ErrorAction SilentlyContinue | Out-Null
        Set-ItemProperty -Path $Name -Name 'Enabled' -Value 0 -Force -ErrorAction SilentlyContinue | Out-Null
    }
}
Wait-Job -Id $Job.Id | Out-Null
Write-Host "Logging is disabled!`n" -ForegroundColor Green

# Apply System Tweaks
Write-Host 'Tweaking System...'
$Job = Start-Job -ScriptBlock {
    Set-ItemProperty -Path 'HKLM:\SYSTEM\ControlSet001\Control\Session Manager\Power' -Name 'HiberbootEnabled' -Value 0 -Force -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\System' -Name 'HiberbootEnabled' -Value 0 -Force -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKLM:\SYSTEM\ControlSet001\Control\Session Manager\Memory Management' -Name 'LargeSystemCache' -Value 1 -Force -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKLM:\SYSTEM\ControlSet001\Control\PriorityControl' -Name 'Win32PrioritySeparation' -Value 0x26 -Force -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKLM:\SYSTEM\ControlSet001\Control\Session Manager\Memory Management\PrefetchParameters' -Name 'EnablePrefetcher' -Value 0 -Force -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKLM:\SYSTEM\ControlSet001\Control\Session Manager\Memory Management\PrefetchParameters' -Name 'EnableSuperfetch' -Value 0 -Force -ErrorAction SilentlyContinue | Out-Null

    # Disable Peernet
    If (!(Test-Path 'HKLM:\SOFTWARE\Policies\Microsoft\Peernet')) { New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Peernet' -Force | Out-Null }
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Peernet' -Name 'Disabled' -Value 1 -Force -ErrorAction SilentlyContinue | Out-Null

    # Disable NetCrawling
    Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'NoNetCrawling' -Value 1 -Force -ErrorAction SilentlyContinue | Out-Null

    # Disable Hibernation
    Start-Process -FilePath 'cmd' -ArgumentList '/c powercfg -h off' -Verb 'Runas' -WindowStyle Hidden -Wait
    Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Power' -Name 'HibernateEnabled' -Value 0 -Force -ErrorAction SilentlyContinue | Out-Null

    # Clear Document Info on Exit
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'ClearRecentDocsOnExit' -Value 1 -Force -ErrorAction SilentlyContinue | Out-Null

    # Disable Settings Sync
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\SettingSync' -Name 'EnableBackupForWin8Apps' -Value 0 -Force -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\SettingSync' -Name 'DisableSettingSync' -Value 1 -Force -ErrorAction SilentlyContinue | Out-Null

    # Disable SmartScreen
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\System' -Name 'EnableSmartScreen' -Value 0 -Force -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer' -Name 'SmartScreenEnabled' -Value 'Off' -Force -ErrorAction SilentlyContinue | Out-Null

    # Disable Input Data Collection
    New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\InputPersonalization' -Force | Out-Null
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\InputPersonalization' -Name 'RestrictImplicitInkCollection' -Value 1 -Force -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\InputPersonalization' -Name 'RestrictImplicitTextCollection' -Value 1 -Force -ErrorAction SilentlyContinue | Out-Null

    # Disable NTFS Encryption
    Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Policies' -Name 'NtfsDisableEncryption' -Value 1 -Force -ErrorAction SilentlyContinue | Out-Null

    # Disable System Restore
    If (!(Test-Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\SystemRestore')) { New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\SystemRestore' -Force | Out-Null }
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\SystemRestore' -Name 'DisableConfig' -Value 1 -Force -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\SystemRestore' -Name 'DisableSR' -Value 1 -Force -ErrorAction SilentlyContinue | Out-Null

    # File Protection
    If (!(Test-Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Windows File Protection')) { New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Windows File Protection' -Force | Out-Null }
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Windows File Protection' -Name SfcScan -Value 0 -ErrorAction SilentlyContinue | Out-Null
    
    # Disable Windows Digital Locker
    If (!(Test-Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Digital Locker')) { New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Digital Locker' -Force | Out-Null }
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Digital Locker' -Name DoNotRunDigitalLocker -Value 1 -ErrorAction SilentlyContinue | Out-Null

    # Disable DEP for Windows Explorer
    If (!(Test-Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer')) { New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer' -Force | Out-Null }
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer' -Name NoDataExecutionPrevention -Value 1 -ErrorAction SilentlyContinue | Out-Null
    
    # Disable File History
    If (!(Test-Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\FileHistory')) { New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\FileHistory' -Force | Out-Null }
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\FileHistory' -Name Disabled -Value 1 -ErrorAction SilentlyContinue | Out-Null

    # Disable Location Stuff
    If (!(Test-Path 'HKLM:\Software\Policies\Microsoft\Windows\LocationAndSensors')) { New-Item -Path 'HKLM:\Software\Policies\Microsoft\Windows\LocationAndSensors' -Force | Out-Null }
    Set-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\LocationAndSensors' -Name DisableLocationScripting -Value 1 -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\LocationAndSensors' -Name DisableLocation -Value 1 -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\LocationAndSensors' -Name DisableSensors -Value 1 -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\LocationAndSensors' -Name DisableWindowsLocationProvider -Value 1 -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Sensors\LocationProvider' -Name CSEnable -Value 0 -ErrorAction SilentlyContinue | Out-Null

    # Disable Remote Desktop
    Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Remote Assistance' -Name fAllowFullControl -Value 0 -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Remote Assistance' -Name fAllowToGetHelp -Value 0 -ErrorAction SilentlyContinue | Out-Null

    # Configure Windows Update
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update' -Name AUOptions -Value 0 -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update' -Name CachedAUOptions -Value 0 -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update' -Name IncludeRecommendedUpdates -Value 0 -ErrorAction SilentlyContinue | Out-Null
    
    # Disable EdgeUI Corners
    If (!(Test-Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ImmersiveShell\EdgeUi')) { New-Item -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ImmersiveShell\EdgeUi' -Force | Out-Null }
    Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ImmersiveShell\EdgeUi' -Name DisableTLCorner -Value 1 -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ImmersiveShell\EdgeUi' -Name DisableTRCorner -Value 1 -ErrorAction SilentlyContinue | Out-Null

    # Disable Tracking
    If (!(Test-Path 'HKLM:\SOFTWARE\Microsoft\Tracing')) { New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Tracing' -Force | Out-Null }
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Tracing' -Name EnableConsoleTracing -Value 0 -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Tracing' -Name EnableFileTracing -Value 0 -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Tracing' -Name EnableAutoFileTracing -Value 0 -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name Start_TrackDocs -Value 0 -ErrorAction SilentlyContinue | Out-Null
    Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name Start_TrackProgs -Value 0 -ErrorAction SilentlyContinue | Out-Null
}
Wait-Job -Id $Job.Id | Out-Null
Write-Host "System is tweaked, press OK to reboot`n" -ForegroundColor Red


# Completion GUI
[System.Windows.Forms.MessageBox]::Show("Optimization completed! Windows 8.1 is free from bloat. Your computer will be restarted for better experience!", "Crap was successfully suppressed!", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Information)

# Restart computer
Restart-Computer -Force