@cgfixit avatar

WINADMIN ARSENAL 2026

@cgfixit • Deadhead Edition • Public Clean Build • 26 Sections • 300+ Commands
Verified Clean No Secrets Public Reference 26 Sections 300+ Commands
No commands match your search. Try a shorter keyword.

01 NETWORK

Full Network Reset One-Liner
ipconfig /flushdns && netsh int ip reset && netsh winsock reset && netsh interface ipv4 reset && netsh interface ipv6 reset && netsh interface tcp reset
Firewall & Connectivity
netsh advfirewall reset
netsh advfirewall show allprofiles
netsh advfirewall set allprofiles state off
netsh advfirewall set allprofiles state on
Test-NetConnection -ComputerName hostname -Port 443
Test-NetConnection -ComputerName 8.8.8.8 -Port 53 -InformationLevel Detailed
IP / ARP / Routing
ipconfig /all
ipconfig /release && ipconfig /renew
arp -a
arp -d *
route print
netstat -an
netstat -bno
ping -t 8.8.8.8
tracert 8.8.8.8
pathping 8.8.8.8
Network Adapter (PowerShell)
Get-NetAdapter | Format-Table Name,Status,MacAddress,LinkSpeed
Disable-NetAdapter -Name "Ethernet" -Confirm:$false
Enable-NetAdapter -Name "Ethernet" -Confirm:$false
Get-NetIPAddress | Where-Object AddressFamily -eq 'IPv4' | Format-Table
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses 8.8.8.8,8.8.4.4
Port Scanning / Testing
Test-NetConnection -ComputerName hostname -Port 445
(New-Object Net.Sockets.TcpClient).Connect("hostname",80)
netstat -ano | findstr :443
netstat -ano | findstr LISTENING

02 DNS

Lookups
nslookup hostname
nslookup -type=MX domain.com
nslookup -type=TXT domain.com
Resolve-DnsName hostname
Resolve-DnsName hostname -Type MX
Resolve-DnsName hostname -Server 8.8.8.8
Cache Management
ipconfig /flushdns
ipconfig /displaydns
ipconfig /registerdns
Clear-DnsClientCache
Get-DnsClientCache | Format-Table
DNS Server (dnscmd)
dnscmd /zoneadd example.com /primary
dnscmd /recordadd example.com host A 192.168.1.10
dnscmd /recorddelete example.com host A 192.168.1.10 /f
dnscmd /clearcache
dnscmd /config /LogLevel 0x8100F333

03 STATIC ROUTES

CMD route
route print
route add 10.0.0.0 mask 255.0.0.0 192.168.1.1
route add 10.0.0.0 mask 255.0.0.0 192.168.1.1 -p
route delete 10.0.0.0 mask 255.0.0.0
route change 10.0.0.0 mask 255.0.0.0 192.168.1.254
PowerShell New-NetRoute
Get-NetRoute -AddressFamily IPv4 | Format-Table
New-NetRoute -DestinationPrefix 10.0.0.0/8 -NextHop 192.168.1.1 -InterfaceAlias "Ethernet"
Remove-NetRoute -DestinationPrefix 10.0.0.0/8 -Confirm:$false
Get-NetRoute | Where-Object { $_.NextHop -ne "0.0.0.0" }

04 USERS & GROUPS

net user (CMD)
net user
net user username /add
net user username * /add
net user username /delete
net user username /active:yes
net user username /active:no
net user username /passwordreq:yes
net localgroup administrators username /add
net localgroup administrators username /delete
net localgroup
PowerShell Local Accounts
Get-LocalUser
Get-LocalUser | Select Name,Enabled,LastLogon | Format-Table
New-LocalUser "labuser" -Password (ConvertTo-SecureString "P@ssw0rd!" -AsPlainText -Force) -FullName "Lab User"
Set-LocalUser -Name "username" -Password (ConvertTo-SecureString "NewPass1!" -AsPlainText -Force)
Enable-LocalUser -Name "username"
Disable-LocalUser -Name "username"
Remove-LocalUser -Name "username"
Add-LocalGroupMember -Group "Administrators" -Member "username"
Remove-LocalGroupMember -Group "Administrators" -Member "username"
Get-LocalGroupMember -Group "Administrators"
Password Policies (cmd)
net accounts
net accounts /maxpwage:90 /minpwlen:12
net accounts /lockoutthreshold:5 /lockoutduration:30

05 RDP

Enable / Disable RDP via Registry
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 1 /f
NLA (Network Level Authentication)
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v UserAuthentication /t REG_DWORD /d 1 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v UserAuthentication /t REG_DWORD /d 0 /f
Change RDP Port
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /t REG_DWORD /d 33890 /f
netsh advfirewall firewall add rule name="RDP Custom Port" protocol=TCP dir=in localport=33890 action=allow
PowerShell RDP Toggle
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -Name "fDenyTSConnections" -Value 0
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
Get-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -Name fDenyTSConnections
Query Active Sessions
qwinsta
qwinsta /server:remotehost
query session
query user
logoff 2

06 PROCESSES

taskkill / tasklist (CMD)
tasklist
tasklist /fi "imagename eq notepad.exe"
tasklist /svc
taskkill /IM notepad.exe /F
taskkill /PID 1234 /F
taskkill /IM chrome.exe /F /T
PowerShell Process Management
Get-Process | Sort-Object CPU -Descending | Select-Object -First 20
Get-Process -Name chrome | Stop-Process -Force
Stop-Process -Id 1234 -Force
Get-Process | Where-Object {$_.WorkingSet -gt 500MB} | Format-Table Name,Id,CPU,@{N='RAM(MB)';E={[math]::Round($_.WorkingSet/1MB,1)}}
Start-Process "notepad.exe"
Start-Process "cmd.exe" -Verb RunAs
Services
Get-Service | Where-Object Status -eq 'Running' | Sort-Object DisplayName
Get-Service -Name wuauserv | Start-Service
Get-Service -Name spooler | Restart-Service
Stop-Service -Name wuauserv -Force
Set-Service -Name spooler -StartupType Automatic
sc query
sc start servicename
sc stop servicename
sc config servicename start= auto

07 SYSTEM HEALTH

DISM Image Repair
DISM /Online /Cleanup-Image /CheckHealth
DISM /Online /Cleanup-Image /ScanHealth
DISM /Online /Cleanup-Image /RestoreHealth
DISM /Online /Cleanup-Image /StartComponentCleanup
SFC & CHKDSK
sfc /scannow
sfc /verifyonly
chkdsk C: /f /r /x
chkdsk C: /scan
System Info
Get-ComputerInfo | Select-Object CsName,WindowsVersion,OsArchitecture,TotalPhysicalMemory
systeminfo
winver
Get-WmiObject -Class Win32_OperatingSystem | Select-Object Caption,Version,BuildNumber,OSArchitecture
[System.Environment]::OSVersion
Disk & Memory
Get-PSDrive -PSProvider FileSystem | Select-Object Name,@{N='Used(GB)';E={[math]::Round($_.Used/1GB,1)}},@{N='Free(GB)';E={[math]::Round($_.Free/1GB,1)}}
Get-PhysicalDisk | Select-Object FriendlyName,MediaType,Size,HealthStatus
[math]::Round((Get-WmiObject Win32_ComputerSystem).TotalPhysicalMemory/1GB,1)
Get-Counter "\Memory\Available MBytes"
Get-Counter "\Processor(_Total)\% Processor Time"
Uptime & Boot
(Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime
(gcim Win32_OperatingSystem).LastBootUpTime
shutdown /r /t 0
shutdown /s /t 0
shutdown /a

08 ROBOCOPY

Common Flags
robocopy C:\Source D:\Dest /MIR /LOG:C:\robocopy.log /NP /R:3 /W:5
robocopy C:\Source D:\Dest /E /COPYALL /LOG+:C:\robocopy.log
robocopy C:\Source D:\Dest /MIR /MT:32 /R:1 /W:1 /NP /TEE /LOG:C:\robocopy.log
robocopy C:\Source D:\Dest /XO /E
robocopy C:\Source D:\Dest *.docx *.xlsx /S
Network / UNC Paths
robocopy \\server\share D:\LocalBackup /MIR /R:3 /W:10 /LOG:C:\backup.log
robocopy C:\LocalData \\server\share\backup /E /COPYALL /DCOPY:DA /LOG+:C:\backup.log
Useful Switches Reference
/MIR   - Mirror (delete extras from dest)
/E     - Include empty subdirs
/COPYALL - Copy all file attributes
/MT:n  - Multi-threaded (default 8, max 128)
/R:n   - Retries (default 1M, set 1-3)
/W:n   - Wait seconds between retries
/LOG:  - Output log file
/NP    - No progress %
/XO    - Exclude Older (skip if dest newer)
/PURGE - Delete dest files not in source

09 LICENSING

slmgr Commands
slmgr /xpr
slmgr /dli
slmgr /dlv
slmgr /ato
slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
slmgr /upk
slmgr /skms kmsserver:1688
slmgr /ckms
slmgr /rearm
Check License Status
Get-WmiObject SoftwareLicensingProduct | Where-Object { $_.LicenseStatus -eq 1 } | Select-Object Name,LicenseStatus
(Get-WmiObject -Query "SELECT * FROM SoftwareLicensingProduct WHERE PartialProductKey <> null AND Name LIKE '%Windows%'").LicenseStatus

10 WINDOWS UPDATE

UsoClient & wuauclt
UsoClient StartScan
UsoClient StartDownload
UsoClient StartInstall
UsoClient RestartDevice
wuauclt /detectnow
wuauclt /updatenow
wuauclt /resetauthorization /detectnow
PSWindowsUpdate Module
Install-Module PSWindowsUpdate -Force -Scope CurrentUser
Get-WindowsUpdate
Install-WindowsUpdate -AcceptAll -AutoReboot
Get-WUHistory | Select-Object -First 20 | Format-Table Date,Title,Result
WSUS / Update Reset
net stop wuauserv && net stop cryptsvc && net stop bits && net stop msiserver
Rename-Item C:\Windows\SoftwareDistribution SoftwareDistribution.bak
Rename-Item C:\Windows\System32\catroot2 catroot2.bak
net start wuauserv && net start cryptsvc && net start bits && net start msiserver

11 RESTORE POINTS

Checkpoint-Computer
Checkpoint-Computer -Description "Pre-patch $(Get-Date -Format 'yyyy-MM-dd')" -RestorePointType MODIFY_SETTINGS
Get-ComputerRestorePoint | Format-Table SequenceNumber,Description,CreationTime
Restore-Computer -RestorePoint 1 -Confirm:$false
Shadow Copies (vssadmin)
vssadmin list shadows
vssadmin list shadowstorage
vssadmin create shadow /for=C:
vssadmin delete shadows /all /quiet
vssadmin resize shadowstorage /for=C: /on=C: /maxsize=10GB

12 ACTIVE DIRECTORY

User Management
Get-ADUser -Filter * | Select-Object Name,SamAccountName,Enabled | Format-Table
Get-ADUser -Identity username -Properties *
New-ADUser -Name "John Doe" -GivenName John -Surname Doe -SamAccountName jdoe -UserPrincipalName [email protected] -Path "OU=Users,DC=domain,DC=com" -AccountPassword (ConvertTo-SecureString "P@ss123!" -AsPlainText -Force) -Enabled $true
Set-ADUser -Identity username -Title "Senior Engineer" -Department "IT"
Disable-ADAccount -Identity username
Enable-ADAccount -Identity username
Unlock-ADAccount -Identity username
Set-ADAccountPassword -Identity username -Reset -NewPassword (ConvertTo-SecureString "NewPass1!" -AsPlainText -Force)
Remove-ADUser -Identity username -Confirm:$false
Groups & OUs
Get-ADGroup -Filter * | Select-Object Name,GroupScope,GroupCategory
Add-ADGroupMember -Identity "Domain Admins" -Members username
Remove-ADGroupMember -Identity "Domain Admins" -Members username -Confirm:$false
Get-ADGroupMember -Identity "Domain Admins" | Select-Object Name,SamAccountName
New-ADOrganizationalUnit -Name "Workstations" -Path "DC=domain,DC=com"
Get-ADOrganizationalUnit -Filter * | Select-Object Name,DistinguishedName
Domain & DC Health
dcdiag /test:all
dcdiag /test:replications
netdom query dc
nltest /dsgetdc:domain.com
nltest /sc_verify:domain.com
repadmin /replsummary
repadmin /showrepl
Get-ADDomainController -Filter * | Select-Object Name,Site,IPv4Address
Group Policy
gpupdate /force
gpupdate /force /boot
gpresult /h C:\gpresult.html
gpresult /r
Get-GPO -All | Select-Object DisplayName,GpoStatus,ModificationTime | Format-Table

13 EXCHANGE / M365

Connect to Exchange Online
Install-Module ExchangeOnlineManagement -Force -Scope CurrentUser
Connect-ExchangeOnline -UserPrincipalName [email protected]
Disconnect-ExchangeOnline -Confirm:$false
Mailboxes
Get-Mailbox | Select-Object DisplayName,PrimarySmtpAddress,RecipientTypeDetails | Format-Table
Get-Mailbox -Identity [email protected] | Select-Object *
Get-MailboxStatistics -Identity [email protected] | Select-Object DisplayName,TotalItemSize,ItemCount
Set-Mailbox -Identity [email protected] -MaxSendSize 50MB -MaxReceiveSize 50MB
New-Mailbox -Name "SharedBox" -Shared -PrimarySmtpAddress [email protected]
Set-MailboxAutoReplyConfiguration -Identity [email protected] -AutoReplyState Enabled -InternalMessage "OOO until date"
Distribution Groups
Get-DistributionGroup | Select-Object DisplayName,PrimarySmtpAddress
New-DistributionGroup -Name "IT Team" -PrimarySmtpAddress [email protected]
Add-DistributionGroupMember -Identity "IT Team" -Member [email protected]
Remove-DistributionGroupMember -Identity "IT Team" -Member [email protected] -Confirm:$false
Get-DistributionGroupMember -Identity "IT Team" | Select-Object Name,PrimarySmtpAddress
Message Trace & Transport
Get-MessageTrace -SenderAddress [email protected] -StartDate (Get-Date).AddDays(-7) -EndDate (Get-Date)
Get-TransportRule | Select-Object Name,State,Priority | Format-Table
Test-MAPIConnectivity -Identity [email protected]

14 HYPER-V

VM Lifecycle
Get-VM | Select-Object Name,State,CPUUsage,MemoryAssigned | Format-Table
Start-VM -Name "VMName"
Stop-VM -Name "VMName" -Force
Restart-VM -Name "VMName" -Force
Suspend-VM -Name "VMName"
Resume-VM -Name "VMName"
Remove-VM -Name "VMName" -Force
Snapshots / Checkpoints
Checkpoint-VM -Name "VMName" -SnapshotName "Pre-Patch $(Get-Date -Format 'yyyy-MM-dd')"
Get-VMSnapshot -VMName "VMName" | Format-Table Name,CreationTime
Restore-VMSnapshot -VMName "VMName" -Name "SnapshotName" -Confirm:$false
Remove-VMSnapshot -VMName "VMName" -Name "SnapshotName" -Confirm:$false
Virtual Switches & Storage
Get-VMSwitch | Format-Table Name,SwitchType,NetAdapterInterfaceDescription
New-VMSwitch -Name "ExternalSwitch" -NetAdapterName "Ethernet" -AllowManagementOS $true
Get-VHD -Path "C:\VMs\disk.vhdx" | Select-Object Path,VhdType,Size,FileSize
New-VHD -Path "C:\VMs\newdisk.vhdx" -SizeBytes 100GB -Dynamic
Add-VMHardDiskDrive -VMName "VMName" -Path "C:\VMs\newdisk.vhdx"
Create New VM
New-VM -Name "NewVM" -MemoryStartupBytes 4GB -NewVHDPath "C:\VMs\NewVM.vhdx" -NewVHDSizeBytes 80GB -Generation 2 -Switch "ExternalSwitch"
Set-VM -Name "NewVM" -ProcessorCount 4 -DynamicMemory -MemoryMinimumBytes 2GB -MemoryMaximumBytes 8GB
Add-VMDvdDrive -VMName "NewVM" -Path "C:\ISO\windows.iso"

15 PRINT SPOOLER

Clear & Restart Spooler
net stop spooler
del /Q /F /S "%systemroot%\System32\spool\PRINTERS\*.*"
net start spooler
PowerShell Print Management
Get-Printer | Select-Object Name,DriverName,PortName,Shared | Format-Table
Get-PrintJob -PrinterName "PrinterName" | Format-Table
Remove-PrintJob -PrinterName "PrinterName" -ID 1
Add-Printer -Name "OfficePrinter" -DriverName "HP LaserJet" -PortName "LPT1:"
Remove-Printer -Name "OldPrinter" -Confirm:$false
Get-PrinterDriver | Select-Object Name,MajorVersion | Format-Table

16 REMOTE TOOLS

PsExec (Sysinternals)
psexec \\remotehost cmd
psexec \\remotehost -u domain\admin -p password cmd
psexec \\remotehost ipconfig /all
psexec \\remotehost -s powershell.exe
psexec @computers.txt ipconfig /flushdns
PowerShell Remoting
Enable-PSRemoting -Force
Enter-PSSession -ComputerName hostname -Credential (Get-Credential)
Exit-PSSession
Invoke-Command -ComputerName hostname -ScriptBlock { Get-Process }
Invoke-Command -ComputerName hostname -Credential (Get-Credential) -FilePath C:\script.ps1
$s = New-PSSession -ComputerName hostname
Invoke-Command -Session $s -ScriptBlock { hostname }
Remove-PSSession $s
WinRM Config
winrm quickconfig -q
winrm set winrm/config/client @{TrustedHosts="*"}
winrm set winrm/config/client @{TrustedHosts="192.168.1.0/24"}
winrm get winrm/config
Test-WSMan -ComputerName hostname

17 POWERSHELL

Execution Policy
Get-ExecutionPolicy -List
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
Set-ExecutionPolicy Unrestricted -Scope Process -Force
Set-ExecutionPolicy Restricted -Scope LocalMachine -Force
Profile & Modules
$PROFILE
notepad $PROFILE
. $PROFILE
Get-Module -ListAvailable | Sort-Object Name
Import-Module ActiveDirectory
Find-Module -Name PSWindowsUpdate | Install-Module -Scope CurrentUser -Force
Get-InstalledModule | Select-Object Name,Version | Format-Table
Update-Module
Useful Snippets
# Export to CSV
Get-Process | Export-Csv C:\procs.csv -NoTypeInformation

# Import CSV and loop
Import-Csv C:\servers.csv | ForEach-Object { Test-Connection $_.Name -Count 1 -Quiet }

# Parallel jobs (PS 7+)
1..10 | ForEach-Object -Parallel { Get-ComputerInfo -ComputerName "server$_" } -ThrottleLimit 5

# Measure command time
Measure-Command { Get-ChildItem C:\ -Recurse }

# Base64 encode/decode
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("Hello"))
[System.Text.Encoding]::UTF8.GetString([Convert]::FromBase64String("SGVsbG8="))

# Grep equivalent
Select-String -Path C:\logs\*.log -Pattern "error" -CaseSensitive:$false

18 EVENT LOGS

Get-WinEvent Queries
Get-WinEvent -LogName System -MaxEvents 50 | Format-Table TimeCreated,Id,LevelDisplayName,Message -AutoSize
Get-WinEvent -LogName Security -MaxEvents 20 | Where-Object Id -eq 4625
Get-WinEvent -LogName Application -MaxEvents 100 | Where-Object LevelDisplayName -eq 'Error'
Get-WinEvent -ListLog * | Where-Object RecordCount -gt 0 | Sort-Object RecordCount -Descending | Select-Object -First 20
Key Security Event IDs
# 4624 - Successful logon
# 4625 - Failed logon
# 4648 - Logon with explicit credentials
# 4720 - User account created
# 4740 - Account locked out
# 4776 - DC credential validation
# 7045 - New service installed
# 4697 - Service installed in the system

Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4625} -MaxEvents 50 | Select-Object TimeCreated,@{N='User';E={$_.Properties[5].Value}},@{N='Workstation';E={$_.Properties[13].Value}} | Format-Table
wevtutil (CMD)
wevtutil el
wevtutil qe System /c:10 /f:text
wevtutil cl System
wevtutil epl Security C:\SecurityLog.evtx

19 NET SHARES / SMB

net share (CMD)
net share
net share ShareName=C:\Path /grant:Everyone,FULL
net share ShareName=C:\Path /grant:"Domain Users",READ
net share ShareName /delete
net use Z: \\server\share /persistent:yes
net use Z: /delete
net use * \\server\share /user:domain\user
PowerShell SMB
Get-SmbShare | Select-Object Name,Path,Description | Format-Table
New-SmbShare -Name "Data" -Path "C:\SharedData" -ReadAccess "Everyone" -FullAccess "Administrators"
Set-SmbShare -Name "Data" -Description "Team data share"
Remove-SmbShare -Name "Data" -Confirm:$false
Get-SmbSession | Select-Object ClientComputerName,ClientUserName,NumOpens | Format-Table
Get-SmbOpenFile | Select-Object FileId,ClientComputerName,Path | Format-Table
Close-SmbSession -SessionId (Get-SmbSession | Where-Object ClientUserName -eq 'domain\user').SessionId -Confirm:$false
Map Drive via PS
New-PSDrive -Name "Z" -PSProvider FileSystem -Root "\\server\share" -Persist -Credential (Get-Credential)
Remove-PSDrive -Name "Z"
Get-PSDrive -PSProvider FileSystem | Format-Table

20 CIM / WMI

Common CIM Queries
Get-CimInstance Win32_ComputerSystem | Select-Object Manufacturer,Model,TotalPhysicalMemory
Get-CimInstance Win32_Processor | Select-Object Name,NumberOfCores,MaxClockSpeed
Get-CimInstance Win32_BIOS | Select-Object Manufacturer,SMBIOSBIOSVersion,ReleaseDate
Get-CimInstance Win32_LogicalDisk | Select-Object DeviceID,DriveType,@{N='Size(GB)';E={[math]::Round($_.Size/1GB,1)}},@{N='Free(GB)';E={[math]::Round($_.FreeSpace/1GB,1)}}
Get-CimInstance Win32_NetworkAdapterConfiguration | Where-Object IPEnabled | Select-Object Description,IPAddress,MACAddress
Get-CimInstance Win32_PhysicalMemory | Select-Object Tag,Capacity,Speed,Manufacturer
Remote CIM
$sess = New-CimSession -ComputerName remotehost -Credential (Get-Credential)
Get-CimInstance -CimSession $sess -ClassName Win32_OperatingSystem
Invoke-CimMethod -CimSession $sess -ClassName Win32_OperatingSystem -MethodName Reboot
Remove-CimSession $sess

21 HARDENING

Disable SMBv1 (Critical)
Set-SmbServerConfiguration -EnableSMB1Protocol $false -Confirm:$false
Set-SmbServerConfiguration -EnableSMB2Protocol $true -Confirm:$false
Get-SmbServerConfiguration | Select-Object EnableSMB1Protocol,EnableSMB2Protocol
Get-WindowsOptionalFeature -Online -FeatureName smb1protocol
Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol -NoRestart
BitLocker
Enable-BitLocker -MountPoint "C:" -EncryptionMethod XtsAes256 -UsedSpaceOnly -TpmProtector
Get-BitLockerVolume | Select-Object MountPoint,VolumeStatus,EncryptionPercentage,ProtectionStatus
Manage-bde -status C:
Manage-bde -protectors -get C:
Backup-BitLockerKeyProtector -MountPoint "C:" -KeyProtectorId (Get-BitLockerVolume C:).KeyProtector[0].KeyProtectorId
Windows Defender
Get-MpComputerStatus | Select-Object AMRunningMode,AntivirusEnabled,RealTimeProtectionEnabled,AntispywareEnabled
Update-MpSignature
Start-MpScan -ScanType QuickScan
Start-MpScan -ScanType FullScan
Set-MpPreference -DisableRealtimeMonitoring $false
Add-MpPreference -ExclusionPath "C:\AllowedPath"
Get-MpPreference | Select-Object ExclusionPath,ExclusionExtension
AppLocker
Get-AppLockerPolicy -Effective | Format-List
Set-AppLockerPolicy -XmlPolicy C:\applocker.xml -Merge
Get-ChildItem C:\Windows\System32 | Get-AppLockerFileInformation | New-AppLockerPolicy -RuleType Publisher,Hash -User Everyone -Optimize
Audit Policy
auditpol /get /category:*
auditpol /set /subcategory:"Logon" /success:enable /failure:enable
auditpol /set /subcategory:"Account Logon" /success:enable /failure:enable
secedit /export /cfg C:\secpol.cfg
secedit /configure /cfg C:\secpol.cfg /db C:\secpol.db
Firewall Rules
New-NetFirewallRule -DisplayName "Block RDP" -Protocol TCP -LocalPort 3389 -Action Block -Direction Inbound
New-NetFirewallRule -DisplayName "Allow HTTPS" -Protocol TCP -LocalPort 443 -Action Allow -Direction Inbound
Get-NetFirewallRule | Where-Object Enabled -eq True | Select-Object DisplayName,Direction,Action | Format-Table
Remove-NetFirewallRule -DisplayName "Block RDP" -Confirm:$false

22 WINGET / CHOCO

winget
winget search firefox
winget install Mozilla.Firefox
winget install Microsoft.PowerShell
winget install Microsoft.VisualStudioCode
winget upgrade --all
winget upgrade Microsoft.PowerShell
winget uninstall Mozilla.Firefox
winget list
winget export -o C:\packages.json
winget import -i C:\packages.json
Chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco install 7zip notepadplusplus -y
choco install googlechrome -y
choco upgrade all -y
choco list --localonly
choco uninstall 7zip -y
choco search python

23 STORAGE SPACES

Pool Management
Get-StoragePool | Select-Object FriendlyName,OperationalStatus,HealthStatus,Size | Format-Table
Get-PhysicalDisk | Select-Object FriendlyName,MediaType,Size,HealthStatus,OperationalStatus | Format-Table
$disks = Get-PhysicalDisk -CanPool $true
New-StoragePool -FriendlyName "DataPool" -StorageSubsystemFriendlyName "Windows Storage*" -PhysicalDisks $disks
Remove-StoragePool -FriendlyName "DataPool" -Confirm:$false
Virtual Disks
New-VirtualDisk -StoragePoolFriendlyName "DataPool" -FriendlyName "DataVD" -ResiliencySettingName Mirror -Size 500GB -ProvisioningType Fixed
Get-VirtualDisk | Select-Object FriendlyName,ResiliencySettingName,OperationalStatus,HealthStatus | Format-Table
Initialize-Disk -Number (Get-Disk | Where-Object PartitionStyle -eq RAW).Number -PartitionStyle GPT
New-Partition -DiskNumber 1 -UseMaximumSize -AssignDriveLetter | Format-Volume -FileSystem NTFS -NewFileSystemLabel "DataVol"

24 ZPOOL / ZFS

Pool Operations
zpool status
zpool list
zpool create datapool mirror /dev/sdb /dev/sdc
zpool create datapool raidz /dev/sdb /dev/sdc /dev/sdd
zpool scrub datapool
zpool destroy datapool
zpool export datapool
zpool import datapool
zpool add datapool mirror /dev/sde /dev/sdf
ZFS Datasets & Snapshots
zfs list
zfs create datapool/data
zfs snapshot datapool/data@snap1
zfs list -t snapshot
zfs rollback datapool/data@snap1
zfs destroy datapool/data@snap1
zfs send datapool/data@snap1 | zfs receive backuppool/data
zfs set compression=lz4 datapool/data
zfs set atime=off datapool/data
zfs get all datapool/data

25 UNIFI / NETWORK

Device Adoption & SSH
set-inform http://controller_ip:8080/inform
mca-cli-op info
mca-cli-op stat
syswrapper.sh restore-default
upgrade http://dl.ubnt.com/unifi/firmware/U7PG2/BZ.qca956x.v4.3.20.11298.190322.2207.bin
UniFi Controller (Linux)
systemctl start unifi
systemctl stop unifi
systemctl restart unifi
systemctl status unifi
journalctl -u unifi -f
mongodump --db ace --out /tmp/unifi_backup_$(date +%Y%m%d)
Network Debugging (UniFi OS)
show interfaces
show wireless
show station
show arp
ping 8.8.8.8 count 5
traceroute 8.8.8.8

26 MISC + 2025/26

WSL2
wsl --install
wsl --list --verbose
wsl --set-default-version 2
wsl --set-version Ubuntu 2
wsl --update
wsl --shutdown
wsl --export Ubuntu C:\Backup\ubuntu.tar
wsl --import Ubuntu C:\WSL\Ubuntu C:\Backup\ubuntu.tar
PowerShell 7 / pwsh
winget install Microsoft.PowerShell
$PSVersionTable
Get-PSRepository
Register-PSRepository -Default
Install-Module -Name PowerShellGet -Force -AllowClobber
# Parallel foreach (PS7+)
1..5 | ForEach-Object -Parallel { "Item: $_"; Start-Sleep 1 } -ThrottleLimit 5
Oh-My-Posh / Terminal
winget install JanDeDobbeleer.OhMyPosh
oh-my-posh init pwsh | Invoke-Expression
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\agnoster.omp.json" | Invoke-Expression
# Add to profile:
oh-my-posh init pwsh | Invoke-Expression
Windows 11 / 2025 Admin Notes
# Check for Recall feature (opt-out)
Get-WindowsOptionalFeature -Online | Where-Object FeatureName -like "*Recall*"
Disable-WindowsOptionalFeature -Online -FeatureName "WindowsRecall" -NoRestart

# Dev Drive (ReFS) — create with Disk Mgmt or:
New-VHD -Path C:\DevDrive.vhdx -SizeBytes 50GB -Dynamic
Mount-VHD -Path C:\DevDrive.vhdx
Initialize-Disk (Get-Disk | Where-Object PartitionStyle -eq RAW | Select-Object -First 1).Number -PartitionStyle GPT
New-Partition -DiskNumber 1 -UseMaximumSize -AssignDriveLetter | Format-Volume -FileSystem ReFS -NewFileSystemLabel "DevDrive"

# Sudo for Windows (Win11 24H2+)
sudo netsh interface set interface "Ethernet" admin=disabled

# Fast Startup disable (avoid disk corruption)
powercfg /h off
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /v HiberbootEnabled /t REG_DWORD /d 0 /f
Useful One-Liners
# Find large files
Get-ChildItem C:\ -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.Length -gt 500MB } | Sort-Object Length -Descending | Select-Object FullName,@{N='GB';E={[math]::Round($_.Length/1GB,2)}} | Select-Object -First 20

# Kill all chrome
Get-Process chrome -ErrorAction SilentlyContinue | Stop-Process -Force

# Check TLS versions
[Net.ServicePointManager]::SecurityProtocol
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13

# Export running services
Get-Service | Where-Object Status -eq 'Running' | Export-Csv C:\running-services.csv -NoTypeInformation

# Environment variables
[Environment]::GetEnvironmentVariables("Machine")
[Environment]::SetEnvironmentVariable("MY_VAR", "value", "Machine")