Skip to content

Instantly share code, notes, and snippets.

@dpi0
Created July 21, 2024 10:47
Show Gist options
  • Save dpi0/48eb9db47459440ff5fd0414c07ef4e0 to your computer and use it in GitHub Desktop.
Save dpi0/48eb9db47459440ff5fd0414c07ef4e0 to your computer and use it in GitHub Desktop.
## initial setup
**powershell as admin**
```powershell linenums="1"
irm christitus.com/win | iex
```
https://github.com/Raphire/Win11Debloat
**in tweaks:**
- install all laptop tweaks
- dark theme `on`
- numlock on startup `on`
- show file extensions `on`
- sticky keys `off`
- taskbar widgets `off`
- add and activate ultimate performance plan
- set time to UTC `ON`
**in config:,**
- disable web search suggestions, then install features
**in updates:**
- set `security settings`
**then head into windows settings:**
- start looking for updates and enable all OPTIONAL updates
- change time zone to Kolkata
- DON'T change the region, stay witb default US
- chnage time formatting from advanced time then calendar settings to 24H one
**continue to change everything while updates install**
- turn off fast startup
- change pc name
```powershell
# get current name
Get-ComputerInfo -Property CsName
# change name
Rename-Computer -NewName "windows"
# reboot
```
- add user password (don't use pin)
- enable windows features: virtual machine platform and windows subsystem for linux
```powershell
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# reboot
```
- then activate using MAS if not already activated
```powershell linenums="1"
irm https://get.activated.win | iex
```
install all updates then restart
**keep restarting until all updates installed and NO new updates left, then move ahead**
---
## setup firefox
- bitwarden
- login github, google and protonmail
- login firefox account, sign in and sync all settings
## install winget
<https://github.com/microsoft/winget-cli/releases>
use the msix bundle to properly install/reinstall this (on win11 it comes preinstalled)
## remove bloat
**powershell as admin**
get the current list of installed apps:
```powershell linenums="1"
Get-AppxPackage | Select Name, PackageFullName
# then follow this pattern
Get-AppxPackage *<app-name>* | Remove-AppxPackage
```
```powershell linenums="1"
Set-ExecutionPolicy Unrestricted -Scope CurrentUser
Get-AppxPackage *windowsmaps* | Remove-AppxPackage
Get-AppxPackage *phone* | Remove-AppxPackage
Get-AppxPackage *zune* | Remove-AppxPackage
Get-AppxPackage *Microsoft.WindowsCamera* | Remove-AppxPackage
Get-AppxPackage -allusers Microsoft.549981C3F5F10 | Remove-AppxPackage
Get-AppxPackage *bing* | Remove-AppxPackage
Get-AppxPackage *officehub* | Remove-AppxPackage
Get-AppxPackage *gethelp* | Remove-AppxPackage
Get-AppxPackage *3dbuilder* | Remove-AppxPackage
Get-AppxPackage *soundrecorder* | Remove-AppxPackage
Get-AppxPackage *solitaire* | Remove-AppxPackage
Get-AppxPackage *Microsoft.Getstarted* | Remove-AppxPackage
Get-AppxPackage Microsoft.YourPhone -AllUsers | Remove-AppxPackage
Get-AppxPackage Microsoft.GetHelp -AllUsers | Remove-AppxPackage
Get-AppxPackage Microsoft.XboxGamingOverlay | Remove-AppxPackage
Get-AppxPackage Microsoft.MSPaint | Remove-AppxPackage
Get-AppxPackage *Xbox* | Remove-AppxPackage
Get-AppxPackage *xboxapp* | Remove-AppxPackage
Get-AppxPackage *windowscommunicationsapps* | Remove-AppxPackage
Get-AppxPackage *3DBuilder* | Remove-AppxPackage
Get-AppxPackage *MicrosoftOfficeHub* | Remove-AppxPackage
Get-AppxPackage *OneNote* | Remove-AppxPackage
Get-AppxPackage *people* | Remove-AppxPackage
Get-AppxPackage *SkypeApp* | Remove-AppxPackage
Get-AppxPackage *solit* | Remove-AppxPackage
Get-AppxPackage *WindowsSoundRecorder* | Remove-AppxPackage
Get-AppxPackage *CommsPhone* | Remove-AppxPackage
Get-AppxPackage *ConnectivityStore* | Remove-AppxPackage
Get-AppxPackage *Microsoft.Messaging* | Remove-AppxPackage
Get-AppxPackage *Facebook* | Remove-AppxPackage
Get-AppxPackage *Twitter* | Remove-AppxPackage
Get-AppxPackage *Drawboard PDF* | Remove-AppxPackage
Get-AppxPackage *bingfinance* | Remove-AppxPackage
Get-AppxPackage *bingsports* | Remove-AppxPackage
Get-AppxPackage *bingweather* | Remove-AppxPackage
Get-AppxPackage *Todos* | Remove-AppxPackage
Get-AppxPackage *Teams* | Remove-AppxPackage
Get-AppxPackage *OneDriveSync* | Remove-AppxPackage
Get-AppxPackage *phototastic* | Remove-AppxPackage
Get-AppxPackage *SpotifyMusic* | Remove-AppxPackage
Get-AppxPackage *MicrosoftStickyNotes* | Remove-AppxPackage
Get-AppxPackage *picsart* | Remove-AppxPackage
Get-AppxPackage *ScreenSketch* | Remove-AppxPackage
Get-AppxPackage *WindowsFeedbackHub* | Remove-AppxPackage
taskkill /f /im OneDrive.exe
winget uninstall OneDriveSetup.exe
winget uninstall “windows web experience pack”
# telemetry
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Device Metadata" /v PreventDeviceMetadataFromNetwork /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /v "AllowTelemetry" /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\MRT" /v DontOfferThroughWUAU /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\SQMClient\Windows" /v "CEIPEnable" /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\AppCompat" /v "AITEnable" /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\AppCompat" /v "DisableUAR" /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v "AllowTelemetry" /t REG_DWORD /d 0 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\AutoLogger-Diagtrack-Listener" /v "Start" /t REG_DWORD /d 0 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\SQMLogger" /v "Start" /t REG_DWORD /d 0 /f
# stop useless scheduled tasks
schtasks /Change /TN "Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" /Disable
schtasks /Change /TN "Microsoft\Windows\Application Experience\ProgramDataUpdater" /Disable
schtasks /Change /TN "Microsoft\Windows\Application Experience\StartupAppTask" /Disable
schtasks /Change /TN "Microsoft\Windows\Customer Experience Improvement Program\Consolidator" /Disable
schtasks /Change /TN "Microsoft\Windows\Customer Experience Improvement Program\KernelCeipTask" /Disable
schtasks /Change /TN "Microsoft\Windows\Customer Experience Improvement Program\UsbCeip" /Disable
schtasks /Change /TN "Microsoft\Windows\Customer Experience Improvement Program\Uploader" /Disable
schtasks /Change /TN "Microsoft\Windows\Shell\FamilySafetyUpload" /Disable
schtasks /Change /TN "Microsoft\Office\OfficeTelemetryAgentLogOn" /Disable
schtasks /Change /TN "Microsoft\Office\OfficeTelemetryAgentFallBack" /Disable
schtasks /Change /TN "Microsoft\Office\Office 15 Subscription Heartbeat" /Disable
# disable hotsport wifi sharing
reg add "HKLM\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" /v value /t REG_DWORD /d 0 /f
reg add "HKLM\Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" /v value /t REG_DWORD /d 0 /f
# show hidden files (done already by titus but just in case)
REM reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "Hidden" /t REG_DWORD /d 1 /f
REM reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowSuperHidden" /t REG_DWORD /d 1 /f
# show file extensions (again done already)
reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "HideFileExt" /t REG_DWORD /d 0 /f
# to remove the windows backup app, first get the current version
dism /online /get-packages
Remove-WindowsPackage -Online -PackageName "Microsoft-Windows-UserExperience-Desktop-Package~31bf3856ad364e35~amd64~~10.0.19041.3393"
# then reboot when prompted
# remove ms-gaming overlay link
reg add HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR /f /t REG_DWORD /v "AppCaptureEnabled" /d 0
reg add HKEY_CURRENT_USER\System\GameConfigStore /f /t REG_DWORD /v "GameDVR_Enabled" /d 0
wsreset
```
## install apps
```powershell linenums="1"
winget install --id=Git.Git -e
winget install --id=chrisant996.Clink -e
winget install --id=GitHub.cli -e
winget install --id=Gyan.FFmpeg -e
winget install --id=JesseDuffield.lazygit -e
winget install --id=gerardog.gsudo -e
winget install --id=Cygwin.Cygwin -e
winget install --id=yt-dlp.yt-dlp -e
winget install --id=Python.Python.3.12 -e
winget install --id=7zip.7zip -e
winget install --id=CPUID.CPU-Z -e
winget install --id=CPUID.HWMonitor -e
winget install --id=Jellyfin.JellyfinMediaPlayer -e
winget install --id=LocalSend.LocalSend -e
winget install --id=MediaArea.MediaInfo.GUI -e
winget install --id=voidtools.Everything.Alpha -e
winget install --id=OBSProject.OBSStudio -e
winget install --id=ShareX.ShareX -e
winget install --id=OpenWhisperSystems.Signal -e
winget install --id=WiresharkFoundation.Wireshark -e
winget install --id=WireGuard.WireGuard -e
winget install --id=AntibodySoftware.WizTree -e
winget install --id=VideoLAN.VLC -e
winget install --id=SublimeHQ.SublimeText.4 -e
winget install --id=RustDesk.RustDesk -e
winget install --id=TorProject.TorBrowser -e
winget install --id=AdrienAllard.FileConverter -e
winget install --id=Microsoft.VisualStudioCode -e
winget install --id=WireGuard.WireGuard -e
winget install --id=Proton.ProtonVPN -e
winget install --id=BiniSoft.WindowsFirewallControl -e
winget install --id=Valve.Steam -e
winget install --id=qBittorrent.qBittorrent -e
winget install --id=Alacritty.Alacritty -e
winget install --id=AltDrag.AltDrag -e
winget install --id=Playnite.Playnite -e
winget install --id=Balena.Etcher -e
winget install --id=REALiX.HWiNFO -e
winget install --id=AutoHotkey.AutoHotkey -v "1.1.37.02" -e
winget install --id=IDRIX.VeraCrypt -e
winget install --id=Nilesoft.Shell -e
# without admin
winget install --id=Spotify.Spotify -e
# if needed
winget install --id=KDE.Kdenlive -e
winget install --id=xanderfrangos.twinkletray -e
```
**translucent-tb**: get the .appinstaller file <https://github.com/TranslucentTB/TranslucentTB/releases>
**whatsapp**: <https://www.whatsapp.com/download>
**vmware workstation 17**: <https://www.vmware.com/products/workstation-player/workstation-player-evaluation.html>
## auth git with github
```powershell linenums="1"
gh auth login
gh repo clone fonts
cd fonts
```
## add system path
```powershell
setx /M PATH "%PATH%;C:\cygwin64\bin"
# verify
$env:PATH
```
## install office
<https://gravesoft.dev/office_c2r_links>
then activate it
```powershell linenums="1"
irm https://get.activated.win | iex
```
## manage internet access via `netsh`
```powershell linenums="1"
netsh interface show interface
sudo netsh interface set interface name="Wi-Fi" admin=disable
sudo netsh interface set interface name="Wi-Fi" admin=enable
```
## fix nilesoft shell theme
`C:\Program Files\Nilesoft Shell\imports`
change `dark = sys.dark` --> `dark = true`
## setup wsl
```powershell linenums="1"
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# reboot
wsl --set-default-version 2
wsl --update
wsl --status
wsl -v
# get a list of all available distros
wsl -l --online
---
PS C:\Windows\system32> wsl -l -o
The following is a list of valid distributions that can be installed.
Install using 'wsl.exe --install <Distro>'.
NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTS
Ubuntu-22.04 Ubuntu 22.04 LTS
Ubuntu-24.04 Ubuntu 24.04 LTS
OracleLinux_7_9 Oracle Linux 7.9
OracleLinux_8_7 Oracle Linux 8.7
OracleLinux_9_1 Oracle Linux 9.1
openSUSE-Leap-15.5 openSUSE Leap 15.5
SUSE-Linux-Enterprise-Server-15-SP4 SUSE Linux Enterprise Server 15 SP4
SUSE-Linux-Enterprise-15-SP5 SUSE Linux Enterprise 15 SP5
openSUSE-Tumbleweed openSUSE Tumbleweed
---
# NOTE: don't directly use wsl --install, always manually specify the distro to install
wsl --install Ubuntu-24.04
# took about 2 mins, 3-4G and 1.2G RAM initially
# NOTE: windows in it's classic confusing garbage fashion, creates two "versions" of ubuntu one named "Ubuntu 24.04 LTS" and another named "Ubuntu" (?) that seemed to AGAIN install ubuntu fsfkr!
# NOTE: don't use the "Ubuntu" thingy and continue using "Ubuntu 24.04 LTS"
# NOTE: or even simple, just launch `wsl` from anywhere and it'll launch "Ubuntu 24.04 LTS"
# to directly access the WSL files
cd \\wsl$\Ubuntu-24.04
# if multiple distros installed
wsl --set-default Ubuntu-24.04
# to launch a specific distro
wsl -d Ubuntu-24.04
# to run a single command in a distro
wsl -d Ubuntu-24.04 whoami
# to check wsl status
wsl -l -v
# manage wsl config
cat /etc/wsl.conf
# to uninstall, below unregisters the distribution and deletes the root filesystem.
wsl --unregister Ubuntu-24.04
```
### backup the distro
```powershell linenums="1"
# terminate to stop only a single running distro
wsl --terminate Ubuntu-24.04
# check if something still running
wsl -l -v
---
PS C:\Users\dpi0> wsl -l -v
NAME STATE VERSION
* Ubuntu-24.04 Stopped 2
---
# and then shutdown, Immediately terminates all running distributions
wsl --shutdown
# to export
wsl --export Ubuntu-24.04 C:\Users\dpi0\Desktop\Ubuntu-24.04-export.tar
# for a fresh install created a tar of 1G
# to import
# first setup wsl properly and then,
wsl --import Ubuntu-24.04 C:\Users\dpi0\path\to\file\Ubuntu-24.04-export.tar
# NOTE: you can also take .vhdx backups and restore but idk about it yet
```
NOTE: currently wsl2 can only mount ext4 partitions present on a SEPERATE drive from the windows installed one, classic windows!
### WSL networking on LAN
say i launched a ngnix container inside WSL and mapped 8080:80, now localhost:8080 works BUT to access this port on LAN
```bash linenums="1"
mkdir ~/site
touch ~/site/index.html
# add https://www.w3schools.com/html/
docker network create test-network
docker run --name nginx-test --network test-network -p 8080:80 -v /home/dpi0/site/:/usr/share/nginx/html:ro -d nginx
```
```powershell linenums="1"
# open port in the windows firewall
netsh advfirewall firewall add rule name="Open Port for docker" dir=in action=allow protocol=TCP localport=<the-port-to-open>
netsh advfirewall firewall add rule name="Open Port for docker" dir=in action=allow protocol=TCP localport=8080
# list all the fucking rules, fuck windows this garbage command
netsh advfirewall firewall show rule dir=in name=all
# create a forwarding rule for windows NIC adapter 8080 --> localhost 8080 (essentially WSL)
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=<the-port-you-have-opened> connectaddress=localhost connectport=<the port that your app is listening on>
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=8080 connectaddress=localhost connectport=8080
```
!!! note
set the `connectaddress` to `localhost` and NOT to the IP address of the WSL because by default the requests that go to localhost are forwarded to the WSL.
By doing this you won't need to set the port forwarding every time you restart your machine because the IP address of the WSL is dynamic.
otherwise you can just use the IP of the WSL instance, connectaddress=172.30.16.3
---
**touchpad gestures:**
| Gesture | Action |
| ------- | ----------------------------------------------- |
| Tap | `Ctrl + T` |
| Up | `Ctrl + W` |
| Down | `F5` |
| Left | `Ctrl + Shift + Tab` |
| Right | `Ctrl + Tab` |
| Tap | `Ctrl + PrintScreen` (ShareX region screenshot) |
| Up | `Ctrl + Alt + Tab` |
| Down | `Alt + Tab` |
| Left | Back |
| Right | Forward |
**shutdown commands:**
reboot wo delay: `shutdown -t 0 -r`
reboot into uefi menu: `shutdown -t 0 -r fw`
reboot into advanced startup settings: `shutdown -t 0 -r -o`
**enable group policy editor:**
```powershell linenums="1"
sudo FOR %F IN ("%SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~*.mum") DO (DISM /Online /NoRestart /Add-Package:"%F")
sudo FOR %F IN ("%SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~*.mum") DO (DISM /Online /NoRestart /Add-Package:"%F")
```
**to safely clean an infected usb/ssd/hdd**
on windows, turn autoplay off first, and honestly do this only when reinstalling windows
```powershell linenums="1"
as cmd admin diskpart
list disk
sel disk n
clean all (then wait for a long time, longer if drive bigger, it does all bits to 0 so safe)
```
**SAFER METHOD, live linux OS**
```powershell linenums="1"
sudo fdisk /dev/disk/by-id/xxxxxx
sudo dd if=/dev/zero of=/dev/sdxxxx bs=4M status=progress (wait)
sudo mkfs any table on it, done
```
**SAFEST METHOD, use DBAN, this overwrites it to hell and back**
- download the live iso for it
- create a bootable drive just for that 20M iso
- follow the steps carefully in the live media
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment