Windows
Lock RDP session
rundll32.exe user32.dll,LockWorkStation
wmic Cheat SheetEdit Cheat Sheet
Useful Examples
Getting to know the system
wmic bios get Manufacturer,Name,Version
wmic diskdrive get model,name,freespace,size # physical disks
wmic logicaldisk get name # logical disks
wmic printer list status
wmci printerconfig list
wmic os list brief # Windows version incl. serial
wmic product list brief # installed programs
wmic startup list fullFor interactive mode just run
wmicfrom there use “quit” or “exit” to terminate again.
Process Management
List running processes
wmic process list
wmic process list brief
wmic process list brief find "calc.exe"
wmic process list fullStart and Stop
wmic process call create "calc.exe"
wmic process where name="calc.exe" call terminateAnd change priority
wmic process where name="calc.exe" call setpriority 64Check environment variables
wmic environment listUser Management
wmic group list brief
wmic useraccount list
wmic sysaccount listUpdates
wmic qfe list # List of missing patchesRemote Access
Run any command remote, e.g.
wmic /node:<ip> /user:<user> /password:<password> os list briefEnable RDP
wmic /node:<ip> /user:<user> /password:<password> RDToggle where ServerName=<server name> call SetAllowTSConnections 1Registry Cheat SheetEdit Cheat Sheet
reg Usage
reg query [domain]\[key] /v [value] # Query a single key value
reg query [domain]\[key] /v [value] /s # Query a single key value recursively
reg add [domain]\[key] # Add a key
reg export [domain]\[key] output.reg # Export subtree to file
reg import output.reg # Import keys from fileRemote Access
To dump a remote registry write something like
reg export \\[ip]\ [domain]\[key] output.regNetsh Cheat SheetEdit Cheat Sheet
Usage Examples
Wifi Troubleshooting
netsh winsock reset
netsh int ip resetInterface Configuration
Show/dump/import active config
netsh interface ip show config
netsh interface ip show config <interface>
netsh -c interface dump > config.txt # dump config
netsh -f config.txt # import configStatic IP
netsh interface ip set address local static [ip] [netmask] [gw] 1DHCP
netsh interface ip set address local dhcp
netsh interface ip set dns <NIC name> dhcp # Ensure to get DNS servers via DHCPDNS
Overwrite currrent DNS config with a single static DNS server
netsh interface ipv4 set dns <NIC name> static <dns server> primaryAdd DNS servers
netsh interface ipv4 add dnsserver <NIC name> address=<dns server> index=<nr>Routes
netsh interface ipv4 show route
netsh interface ipv4 add route x.x.x.x/x <interface name> <gw>
netsh interface ipv4 delete route x.x.x.x/x <interface name> <gw>Firewall
Note “netsh firewall” is deprecated since Vista. Use “netsh advfirewall firewall” instead!
CONFIG DUMPING
netsh advfirewall firewall export c:\temp\wfas.wfw
netsh advfirewall firewall import c:\temp\wfas.wfw
netsh advfirewall firewall reset [export c:\temp\wfas.wfw]TOGGLING STATES
netsh advfirewall firewall set [profiletype]state on
netsh advfirewall firewall set [profiletype]state offCHANGING RULES
netsh advfirewall firewall add rule name="newrule" dir=in action=allow program="%ProgramFiles%\some\program.exe"
netsh advfirewall firewall show rule "newrule" verbose
netsh advfirewall firewall set rule group=”Windows Firewall Remote Management” new enable =yesWSL Cheat SheetEdit Cheat Sheet
For a thorough description see this heise.de article
Setup
Install WSL from CLI
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestartEnable virtualisation support for WSLv2
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestartEnforce WSLv2 as default
wsl --set-default-version 2Manage Distros
wsl -l [-v] # List installed distros
wsl --set-default <name> # Set default distro
wsl --set-version <name> 1 # Force distro to run in WSLv1
wsl --unregister <name> # Uninstall distroGUI Setup
Probably easiest is to install GWSL from the MS app store.
LDAPSEARCH
Last updated
Was this helpful?