Windows 11 services safe to disable for gaming.

Windows 11 services safe to disable for gaming.

  • Hi there and welcome to PC Help Forum (PCHF), a more effective way to get the Tech Support you need!
    We have Experts in all areas of Tech, including Malware Removal, Crash Fixing and BSOD's , Microsoft Windows, Computer DIY and PC Hardware, Networking, Gaming, Tablets and iPads, General and Specific Software Support and so much more.

    Why not Click Here To Sign Up and start enjoying great FREE Tech Support.

    This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

This PowerShell script does the following:​


  • It checks if the script is running with administrator privileges. If not, it restarts itself with elevated privileges.
  • It disables the safe services in Windows 11.
  • The script attempts to stop each service and set its startup type to "Disabled".
  • It cleans temp files from the Windows Temp folder and the user's Temp folder.
  • It disables fast boot by modifying the registry.
  • It sets the power plan to balanced using the powercfg command.

Code:
# Elevate privileges if not already running as administrator
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) 
{ 
  $arguments = "& '" + $myinvocation.mycommand.definition + "'"
  Start-Process powershell -Verb runAs -ArgumentList $arguments
  Exit
}

# 1. Disable safe services in Windows 11
$servicesToDisable = @(
    "AssignedAccessManager",
    "BitLocker",
    "DiagTrack", # Connected User Experiences and Telemetry
    "DusmSvc", # Data Usage
    "lfsvc", # Geolocation Service
    "MapsBroker", # Downloaded Maps Manager
    "Netlogon",
    "defragsvc", # Optimize Drives
    "WpcMonSvc", # Parental Controls
    "PhoneSvc",
    "Spooler", # Print Spooler
    "SessionEnv", # Remote Desktop Configuration
    "TermService", # Remote Desktop Services
    "UmRdpService", # Remote Desktop Services UserMode Port Redirector
    "SensorService",
    "ScDeviceEnum", # Smart Card Device Enumeration Service
    "SCardSvr", # Smart Card
    "ScPolicySvc", # Smart Card Removal Policy
    "WbioSrvc", # Windows Biometric Service
    "WerSvc", # Windows Error Reporting Service
    "workfolderssvc", # Work Folders
    "XblAuthManager", # Xbox Live Auth Manager
    "XblGameSave", # Xbox Live Game Save
    "XboxNetApiSvc", # Xbox Live Networking Service
    "WaaSMedicSvc", # Windows Update Medic Service
    "Fax",
    "WalletService",
    "icssvc", # Windows Mobile Hotspot Service
    "TabletInputService", # Touch Keyboard and Handwriting Panel Service
    "DevicesFlowUserSvc", # DevicePicker
    "AJRouter" # AllJoyn Router Service
)

foreach ($service in $servicesToDisable) {
    $serviceObj = Get-Service -Name $service -ErrorAction SilentlyContinue
    if ($serviceObj) {
        Stop-Service -Name $service -Force -ErrorAction SilentlyContinue
        Set-Service -Name $service -StartupType Disabled
        Write-Host "Disabled service: $service"
    } else {
        Write-Host "Service not found: $service"
    }
}

# 2. Clean all temp files
$tempFolders = @(
    "C:\Windows\Temp\*",
    "$env:TEMP\*"
)

foreach ($folder in $tempFolders) {
    Remove-Item -Path $folder -Recurse -Force -ErrorAction SilentlyContinue
    Write-Host "Cleaned temp files in: $folder"
}

# 3. Disable fast boot
$path = "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power"
$name = "HiberbootEnabled"
Set-ItemProperty -Path $path -Name $name -Value 0
Write-Host "Disabled fast boot"

# 4. Set power plan to balanced
powercfg /setactive 381b4222-f694-41f0-9685-ff5bb260df2e
Write-Host "Set power plan to balanced"

Write-Host "Script execution completed."


To use this script:​


  1. Save it as a .ps1 file (e.g., optimize_windows11.ps1).
  2. Right-click on the file and select "Run with PowerShell".
  3. If prompted, allow the script to run with administrator privileges.

Please note that disabling services and changing system settings can have unintended consequences. It's recommended to create a system restore point before running this script, so you can revert changes if needed. Also, some services might be required for certain features or hardware on your specific system, so make sure you understand the implications of disabling each service before running the script.
Author
Malnutrition
Views
834
First release
Last update

Ratings

0.00 star(s) 0 ratings

More resources from Malnutrition