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 = @(
      "AppVClient",
      "DiagTrack",
      "BDESVC",
      "Browser",
      "DeviceAssociationService",
      "DialogBlockingService",
      "DiagTrack",
      "dmwappushservice",
      "DmEnrollmentSvc",
      "EntAppSvc",
      "Fax",
      "HgClientService",
      "HvHost",
      "InventorySvc",
      "lfsvc",
      "MapsBroker",
      "NetTcpPortSharing",
      "NgcCtnrSvc",
      "NgcSvc",
      "OneDrive Updater Service",
      "p2psvc",
      "PhoneSvc",
      "PNRPsvc",
      "PrintNotify",
      "QWAVE",
      "RasAuto",
      "RasMan",
      "RemoteRegistry",
      "RetailDemo",
      "ssh-agent",
      "SstpSvc",
      "TabletInputService",
      "vmicguestinterface",
      "vmicheartbeat",
      "vmickvpexchange",
      "vmicrdv",
      "vmicshutdown",
      "vmictimesync",
      "vmicvmsession",
      "vmicvss",
      "WalletService",
      "WerSvc",
      "WpcMonSvc",
      "XblAuthManager",
      "XblGameSave",
      "XboxNetApiSvc",
      "AdobeARMservice",
      "BITS",
      "DoSvc",
      "edgeupdate",
      "edgeupdatem",
      "gupdate",
      "gupdatem",
      "HomeGroupListener",
      "HomeGroupProvider",
      "MicrosoftEdgeUpdateService",
      "PcaSvc",
      "SharedAccess",
      "SysMain",
      "TrkWks",
      "UsoSvc",
      "WerSvc",
      "Windows Media Player Network Sharing Service",
      "WMPNetworkSvc",
      "WSearch"
    
)

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"


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
1,594
First release
Last update

Ratings

0.00 star(s) 0 ratings

More resources from Malnutrition