Skip to content

Instantly share code, notes, and snippets.

@djibe
Last active June 5, 2024 02:23
Show Gist options
  • Save djibe/a7fb1050f2f64d9752db96aa010d0a13 to your computer and use it in GitHub Desktop.
Save djibe/a7fb1050f2f64d9752db96aa010d0a13 to your computer and use it in GitHub Desktop.
Windows 10 Command Tweaks

Windows 10 and 11 optimizations

Minimal script

:: Check for updates
%windir%\system32\usoclient ScanInstallWait
:: Set Powermode
powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61

:: Disable deep sleep while preserving fast boot
powercfg /h on
powercfg hibernate size 0
powercfg /h /type reduced

:: Optimize disk access
fsutil behavior set DisableDeleteNotify 0
fsutil behavior set disablelastaccess 1
fsutil behavior set disable8dot3 1
diskperf -N

:: Repair Windows files
sfc /scannow

If sfc fails to repair:

DISM /Online /Cleanup-Image /ScanHealth
DISM /Online /Cleanup-Image /Restorehealth

Compact Windows updates:

Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase
Dism.exe /online /Cleanup-Image /SPSuperseded

Compact Windows files

Compact.exe /CompactOS:always

Make sure Windows Recovery Environment is active

reagentc /info

Optional

  • Remove Widgets: Get-AppxPackage *WebExperience* | Remove-AppxPackage
  • DNS0 (RGPD): 193.110.81.0, 185.253.5.0 and ipv6 2a0f:fc80::, 2a0f:fc81::
  • Battery health report: powerwfg /battery /report
    Located in C:\Users\Utilisateur\battery-report.html
  • Backup drivers: Dism /online /export-driver /destination:D:\Drivers
    Restore: Dism /online /Add-Driver /Driver:D:\Drivers /Recurse

Useless Windows services

  • WIA: sc config "stisvc" start= disabled
  • Netbios: sc config "lmhosts" start= disabled
  • Card: sc config "SCardSvr" start= disabled sc config "SessionEnv" start= disabled sc config "WpcMonSvc" start= disabled sc config "DiagTrack" start= disabled sc config "CscService" start= disabled sc config "MapsBroker" start= disabled sc config "RasAuto" start= disabled sc config "RasMan" start= disabled sc config "XblAuthManager" start= disabled sc config "XblGameSave" start= disabled sc config "seclogon" start= disabled sc config "SharedAccess" start= disabled sc config "RemoteRegistry" start= disabled sc config "vmicvss" start= disabled sc config "RemoteAccess" start= disabled sc config "vmicshutdown" start= disabled sc config "BthAvctpSvc" start= disabled sc config "WbioSrvc" start= disabled sc config "BDESVC" start= disabled sc config "RetailDemo" start= disabled sc config "lfsvc" start= disabled sc config "XboxNetApiSvc" start= disabled sc config "NetTcpPortSharing" start= disabled sc config "CDPSvc" start= disabled sc config "vmicrdv" start= disabled sc config "TabletInputService" start= disabled sc config "ScDeviceEnum" start= disabled sc config "vmicvmsession" start= disabled sc config "MSiSCSI" start= disabled sc config "WMPNetworkSvc" start= disabled sc config "icssvc" start= disabled sc config "vmicheartbeat" start= disabled sc config "SmsRouter" start= disabled sc config "vmictimesync" start= disabled sc config "PhoneSvc" start= disabled sc config "wisvc" start= disabled sc config "vmickvpexchange" start= disabled sc config "SCPolicySvc" start= disabled sc config "Fax" start= disabled sc config "TapiSrv" start= disabled

TODO

  • Disk cleanup
  • Optional functions (IE, OpenSSH)
  • BIOS UEFI or MBR ?
    msinfo32 > Mode BIOS: UEFI/Hérité
  • Restart to UEFI
    • shutdown /r /fw
    • or in command: bcdedit /set {default} bootmenupolicy legacy and F8 at Boot logo
    • or force shutdown 3 times
  • Restart to WinRE: shutdown /r /o /t 0
  • Restart to Safe mode: shutdown /r /o /f /t 0

Edit Send To menu

Run > shell:sendto

Winstall command

Install Winget.

winget install --id=Mozilla.Firefox -e  && winget install --id=VideoLAN.VLC -e  && winget install --id=7zip.7zip -e && winget install --id=LibreOffice.LibreOffice -e && winget install --id=Adobe.AdobeAcrobatReaderDC -e  && winget install --id=AIMP.AIMP -e  && winget install --id=AnyDeskSoftwareGmbH.AnyDesk -e  && winget install --id=Google.Chrome -e && winget install --id=qBittorrent.qBittorrent -e  && winget install --id=Bitdefender.Bitdefender -e && winget install --id=Piriform.CCleaner -e  && winget install --id=Piriform.Recuva -e  && winget install --id=CPUID.CPU-Z.CM -e  && winget install --id=CrystalDewWorld.CrystalDiskInfo -e && winget install --id=Piriform.Defraggler -e && winget install --id=gurnec.HashCheckShellExtension -e  && winget install --id=bricelam.imageresizer -e  && winget install --id=Oracle.JavaRuntimeEnvironment -e && winget install --id=CodecGuide.K-LiteCodecPackMega -e  && winget install --id=CodeJelly.Launchy -e  && winget install --id=Malwarebytes.Malwarebytes -e  && winget install --id=MediaArea.MediaInfo-GUI -e  && winget install --id=Microsoft.VC++2015-2019Redist-x64 -e  && winget install --id=Microsoft.VC++2012Redist-x64 -e  && winget install --id=Microsoft.VC++2005Redist-x86 -e  && winget install --id=Microsoft.VC++2012Redist-x86 -e  && winget install --id=Microsoft.VC++2013Redist-x64 -e  && winget install --id=Microsoft.VC++2013Redist-x86 -e  && winget install --id=Microsoft.VC++2005Redist-x64 -e  && winget install --id=Microsoft.VC++2010Redist-x64 -e  && winget install --id=Microsoft.VC++2010Redist-x86 -e  && winget install --id=Microsoft.VC++2008Redist-x86 -e  && winget install --id=Microsoft.VC++2008Redist-x64 -e  && winget install --id=Microsoft.VisualStudioCode -e  && winget install --id=Mp3tag.Mp3tag -e  && winget install --id=PDFsam.PDFsam -e  && winget install --id=RevoUninstaller.RevoUninstaller -e  && winget install --id=NickeManarin.ScreenToGif -e && winget install --id=SUPERAntiSpyware.SUPERAntiSpyware -e && winget install --id=SVGExplorerExtension.SVGExplorerExtension -e  && winget install --id=TeamViewer.TeamViewer -e && winget install --id=SumatraPDF.SumatraPDF -e

Winstall JB winget install --id=Notepad++.Notepad++ -e && winget install --id=AmineMouafik.Ferdi -e && winget install --id=Files-Community.Files -e && winget install --id=GIMP.GIMP -e && winget install --id=MarekJasinski.FreeCommanderXE -e && winget install --id=Valve.Steam -e && winget install --id=UCBerkeley.BOINC -e && winget install --id=TimKosse.FileZillaClient -e && winget install --id=FoldingAtHome.FoldingAtHome -e && winget install --id=CodeSector.TeraCopy -e && winget install --id=Wargaming.GameCenter -e && winget install --id=AppWork.JDownloader -e

SSD Optimization not available

Optimization not available L'opération demandée n'est pas prise en charge par le matériel sous-jacent au volume. (0x8900002A) winsat formal

Powershell in Administrator mode: Optimize-Volume -DriveLetter c -ReTrim -Verbose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment