Windows Command for Security Analysis
Windows Command for Security Analysis
Commands
for Security
Analysts
1. System Informations Configuration
systeminfo
Displays detailed OS configuration, hardware,
patches (hotfixes).
systeminfo
systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
/C:"System Type" (Quick OS details)#
systeminfo /s <remote_hostname> (Query remote system - requires
permissions)
whoami
Displays current user context.
ver / winver
Displays Windows version.
getmac
Displays MAC address(es).
bcdedit
Manages Boot Configuration Data. (Admin Required)
msinfo32
Opens System Information GUI (comprehensive
hardware/software info).
path
Displays or sets the command search path.
path
wmic
(Windows Management Instrumentation Command-line
- Note: Being deprecated, PowerShell's Get-CimInstance is
preferred, but wmic is still widely used/encountered)
fsutil
File system utility.
msconfig
Opens System Configuration utility (boot options, services, startup).
ipconfig
Displays IP configuration.
ping
Tests network connectivity using ICMP Echo requests.
ping 8.8.8.8
ping -n 20 <hostname_or_ip> (Send 20 pings)
ping -t <hostname_or_ip> (Ping continuously until stopped)
netstat
Displays network connections, listening ports, statistics.
tracert
Traces the route (hops) to a destination.
tracert 8.8.8.8
tracert -d <hostname_or_ip> (Do not resolve addresses to hostnames
- faster)
pathping
Combines ping and tracert, showing latency and packet loss at each
hop over time. More informative than tracert but slower.
pathping 8.8.8.8
pathping -n -q 15 google.com (No hostname resolution, 15 queries
per hop)
nslookup
Queries DNS servers.
arp
Displays and modifies the Address Resolution Protocol (ARP) cache
(IP-to-MAC mapping).
route
Displays and modifies the local IP routing table.
schtasks
Schedules commands and programs (Task Scheduler).
(Admin Required for creating/modifying system tasks)
schtasks /query /fo LIST /v (Detailed list of all tasks) schtasks
/query /tn "MyTask" (Query a specific task)
schtasks /create /tn "MyTask" /tr "C:\path\script.bat" /sc ONLOGON
(Example creation)
schtasks /delete /tn "TaskName" /f (Delete task) schtasks
/run /tn "TaskName" (Run task now)
schtasks /end /tn "TaskName" (Stop running task)
sc (Service Control)
Manages Windows services.
(Admin Required for most actions)
taskmgr
Opens Task Manager GUI.
taskmgr
4. File Systems Data Management
dir
Lists files and directories.
dir C:\Windows
dir /a (Show hidden and system files) dir /s
(Recursive)
dir /b (Bare format, names only) dir
/o:d (Sort by date)
dir /tc (Show creation time)
cd or chdir
Changes directory.
cd C:\Users
cd .. (Move up one level)
md or mkdir
Creates a new directory.
md C:\Temp\NewFolder
rd or rmdir
Removes a directory.
rd C:\Temp\OldFolder (Only if empty)
rd /s /q C:\Temp\OldFolder (Remove directory and contents, quiet
mode - use caution)
del or erase
Deletes files. [WARNING: Destructive]
del C:\Temp\file.txtdel C:\Temp\file.txt
del /f /q C:\Temp\*.tmp (Force delete read-only, quiet mode)
copy
Copies files.
copy C:\file.txt D:\backup\
xcopy
Copies files and directories (more options than copy).
xcopy C:\source D:\dest /E /H /I /Y (/E=subdirs,
/H=hidden/system, /I=assume dest is dir, /Y=suppress prompt)
robocopy
Robust file copy utility (preferred over xcopy).
robocopy C:\source D:\dest /E /COPYALL /R:3 /W:10 (/E=subdirs,
/COPYALL=all file info, /R=retries, /W=wait time)
robocopy C:\source D:\dest /MIR (Mirrors directory -
WARNING: deletes files in dest not in source)
move
Moves files or renames directories.
move C:\file.txt D:\ (Move file)
move C:\OldFolderName C:\NewFolderName (Rename folder)
ren or rename
Renames files or directories.
ren oldname.txt newname.txt
type
Displays contents of a text file.
type C:\Windows\System32\drivers\etc\hosts
find
Searches for a text string in files (basic).
find "error" C:\logs\app.log
findstr
Searches for strings in files (more powerful, supports regex).
findstr /i /s /c:"password" C:\Users\*.txt (Case-insensitive, search
subdirs, literal string)
ipconfig /all | findstr /i "DNS Servers" (Pipe output to findstr)
sort
Sorts input (e.g., file contents) alphabetically.
type names.txt | sort
sort < names.txt > sorted_names.txt
comp / fc
Compares contents of files.
comp file1.bin file2.bin (Binary comparison)
fc file1.txt file2.txt (Text comparison, shows differences)
tree
Displays directory structure graphically.
tree C:\Windows /F (Include files)
attrib
Displays or changes file attributes.
attrib C:\Windows\System32\ntdll.dll (Show attributes)
attrib +h C:\secret.txt (Hide file) (Admin Required often needed)
attrib -r C:\config.ini (Remove read-only)
cipher
Displays or alters file encryption (EFS).
cipher /c <filename> (Show encryption status)
cipher /e C:\SecretFolder (Encrypt folder - new files will be encrypted)
(Admin Required)
cipher /w:C: (Wipe free space - can take a long time) (Admin Required)
compact
Displays or alters file compression (NTFS compression).
compact /c /s:C:\Logs (Compress directory and contents)
(Admin Required)
compact /u /s:C:\Logs (Uncompress) (Admin Required)
diskpart
Manages disks, partitions, and volumes. (Admin Required)
[WARNING: Destructive]
chkdsk
Checks disk for errors and attempts repairs.
chkdsk C: (Read-only check)
chkdsk C: /f (Fixes errors on the disk - requires reboot if system
drive) (Admin Required)
chkdsk C: /r (Locates bad sectors and recovers readable info
- includes /f) (Admin Required)
takeown
Allows administrator to take ownership of a file/folder.
(Admin Required)
takeown /f <filepath_or_folderpath>
takeown /f <folderpath> /r /d y (Take ownership recursively,
default 'yes' to prompts)
icacls
Displays or modifies Access Control Lists (Permissions).
(Admin Required)
openfiles
Queries or displays open files/folders, often accessed via network shares.
(Admin Required)
openfiles /local on (Enable local file tracking - requires reboot) openfiles
/query /v (Verbose query after enabling)
5. User, Group, s Policy Management
net user
Manages user accounts (local database or domain).
net localgroup
Manages local groups. (Admin Required)
gpresult
Displays Group Policy results (Resultant Set of Policy - RSoP).
runas
Runs a program as a different user.
ftype
Displays or modifies file types used in extension associations.
control
Opens Control Panel. Can open specific applets.
control
control printers
control userpasswords2 (Opens advanced user accounts panel)
6. Event Log Management
wevtutil
(Windows Event Utility): Manages event logs. (Admin Required
for Security/System logs)
eventvwr
Opens Event Viewer GUI.
eventvwr
eventvwr <logname> (e.g., eventvwr Security)
7. Security Auditing Utilities
sfc
(System File Checker): Scans and repairs protected system files.
(Admin Required)
auditpol
Manages audit policies. (Admin Required)
bitsadmin
Manages BITS (Background Intelligent Transfer Service) jobs.
Often abused by malware. (Admin Required)
fltmc
Manages audit policies. (Admin Required)
cls
Clears the command prompt screen.
cls
echo
Displays messages or toggles command echoing.
clip
Redirects command output to the Windows clipboard.
shutdown
Shuts down or restarts the computer. (Admin Required)
mmc
Opens Microsoft Management Console (load snap-ins).
services.msc
Opens Services management console GUI.
devmgmt.msc
Opens Device Manager GUI.
diskmgmt.msc
Opens Disk Management GUI.
perfmon
Opens Performance Monitor GUI.
resmon
Opens Resource Monitor GUI.
mstsc
Opens Remote Desktop Connection client.
cleanmgr
Opens Disk Cleanup utility.
defrag
Defragments a drive (less critical on SSDs). (Admin Required)
10. Sys-internals Suite (Highly
Recommended External Tools)
These are not built-in but are considered essential for deep
analysis. Download from Microsoft.