dism /Online /Cleanup-Image /AnalyzeComponentStore
dism /online /Cleanup-Image /StartComponentCleanup
Get-ChildItem -Filter “*current*” -Recurse | Rename-Item -NewName {$_.name -replace ‘current’,’old’ }
- Turn off the sound popup on Google Chrome
Paste chrome://flags/#hardware-media-key-handling
to the browser and turn it off.
- Check file size recursively
Use TreeSize Free (better) or WinDirStat
vssadmin Resize ShadowStorage /For=C: /On=C: /Maxsize=320MB
vssadmin delete shadows /for=c: /all /quiet
- Iterate through all subdirectories and format code
Get-ChildItem -Directory | Foreach-Object {dotnet-format -w $_.FullName}
Get-ChildItem -Directory | Foreach-Object {fantomas $_.FullName}
- Remove items with pattern
Get-ChildItem -Filter "*.txt" -Recurse | Remove-Item
- Update PowerShell by the command line (https://superuser.com/questions/1287032/update-powershell-through-command-line)
Stable version
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
Preview version
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI -Preview"
- Shrink WSL file:
Use https://github.com/mikemaccana/compact-wsl2-disk or https://superuser.com/a/1734392
- Run scripts with PowerShell: https://stackoverflow.com/questions/4037939/powershell-says-execution-of-scripts-is-disabled-on-this-system
powershell -ExecutionPolicy Bypass -File script.ps1
- Remove
wsl
volume
wsl.exe --list --verbose
wsl --unregister <NAME>
- No Internet connection in WSL (https://stackoverflow.com/questions/62314789/no-internet-connection-on-wsl-ubuntu-windows-subsystem-for-linux)
Open PowerShell as an Administrator and type these commands:
netsh winsock reset
netsh int ip reset all
netsh winhttp reset proxy
ipconfig /flushdns
Reboot your machine.