Cyber security
Hacked? Commands to run in Windows CMD
Open Command Prompt as Administrator (search “cmd”, right-click, Run as administrator) and work through these steps.
First: use a different, safe device to change your email, banking and M-Pesa passwords and turn on two-step verification. Don't log in to important accounts on the affected computer until it's clean.
1. See what is connecting to the internet
Lists all active connections and the process ID (PID) using them. Look for unknown foreign addresses.
netstat -anoShows running programs. Match a suspicious PID from netstat to a program name.
tasklistForce-stops a suspicious program (replace 1234 with the PID).
taskkill /PID 1234 /F2. Cut off an attacker
Disconnects the computer from the network immediately.
ipconfig /releaseClears cached website addresses that malware may have changed.
ipconfig /flushdnsMakes sure Windows Firewall is turned on for all networks.
netsh advfirewall set allprofiles state on3. Check for unknown accounts and startup programs
Lists all user accounts. Look for accounts you did not create.
net userShows who has admin rights.
net localgroup administratorsDisables an unknown account (replace the name).
net user SuspiciousName /active:noLists programs that start automatically with Windows.
wmic startup get caption,commandLists scheduled tasks — malware often hides here.
schtasks /query /fo LIST /v4. Scan and repair
Runs a full Microsoft Defender malware scan.
"%ProgramFiles%\Windows Defender\MpCmdRun.exe" -Scan -ScanType 2Finds and repairs damaged Windows system files.
sfc /scannowRepairs the Windows image if sfc cannot fix everything.
DISM /Online /Cleanup-Image /RestoreHealthShows the hosts file. Extra lines can redirect you to fake sites.
type C:\Windows\System32\drivers\etc\hostsStill unsure? Try the auto-help assistant or see our Lumex Digital cyber security services.

