Microsoft Command Line Tool Flashcards
File management
- dir
- List files and directories
- cd
- Change working directory
- Use backslash \ to specify volume or folder name
- ..
- Two dots/periods
- The folder above the current folder
shutdown
- Shutdown a computer
- And optionally restart
- shutdown /s /t nn
- Wait nn seconds, then shutdown
- shutdown /r /t nn
- Shutdown and restart after nn seconds
- shutdown /a
- Abort the countdown!
dism
- Deployment Image Servicing and Management tool
- Manage Windows Imaging Format (WIM) files
- Make changes to your image with DISM
- Get information about an image
- Update applications
- Manage drivers
- Manage updates
- Mount an image
- All command-line based
- Many different options
- Easy to automate
sfc
- Scan integrity of all protected system files
* sfc /scannow
Check Disk
- chkdsk /f
- Fixes logical file system errors on the disk
- chkdsk /r
- Locates bad sectors and recovers readable information
- Implies /f
- If volume is locked, run during startup
DiskPart
- Manage disk configurations
* diskpart - start the DiskPart command interpreter
TaskList
- Manage tasks from the command line
- No Task Manager required!
- tasklist
- Displays a list of currently running processes
- Local or remote machine
taskkill
- Manage tasks from the command line
- No Task Manager required!
- Terminate tasks by process id (PID) or image name
- TASKKILL /IM notepad.exe
- TASKKILL /PID 1234 /T
Group Policy
- Group Policy
- Manage computers in an Active Directory Domain
- Group Policy is usually updated at login
Managing Group Policy
- gpupdate
- Force a Group Policy update
- gpupdate /target:{computer|user} /force
- gpupdate /target:professor /force
- gpresult
- Verify policy settings for a computer or user
- gpresult /r
- gpresult /user sgc/professor /v
Format
- Formats a disk for use with Windows
* format c:
Copy
• Copy files from one location to another
•copy (/a, /v, /y)
•/v - Verifies that new files are written correctly
•/y - Suppresses prompting to confirm you want to
overwrite an existing destination file
Xcopy
- Copies files and directory trees
* xcopy /s Documents m:\backups
Robust Copy
- robocopy
- A better Xcopy
- Included with Windows 7, 8.1, and 10
ipconfig
- Most of your troubleshooting starts with your IP address
- Ping your local router/gateway
- Determine TCP/IP and network adapter information
- And some additional IP details
- View additional configuration details
- DNS servers, DHCP server, etc
ping
- Test reachability
- Determine round-trip time
- Uses Internet Control Message Protocol (ICMP)
- One of your primary troubleshooting tools
- Can you ping the host?
- Written by Mike Muuss in 1983
- The sound made by sonar
- Not an acronym for Packet INternet Groper
tracert
- Determine the route a packet takes to a destination
- Map the entire path
- Takes advantage of ICMP Time to Live Exceeded message
- The time in TTL refers to hops, not seconds or minutes
- TTL=1 is the first router, TTL=2 is the second router, etc.
- Not all devices will reply with ICMP Time Exceeded
- Some firewalls filter ICMP
- ICMP is low-priority for many devices
Flavors of traceroute
- Not all traceroutes are the same
- Minor differences in the transmitted payload
- Windows commonly sends ICMP echo requests
- Receives ICMP time exceeded messages
- And an ICMP echo reply from the final/destination device
- Unfortunately, outgoing ICMP is commonly filtered
• Some operating systems allow you to specify the protocol
Linux, Unix, Mac OS, etc.
- IOS devices send UDP datagrams over port 33434
- The port number can be changed with extended options
- The mechanics of traceroute
netstat
- Network statistics
- Many different operating systems
- netstat -a
- Show all active connections
- netstat -b
- Show binaries (Windows)
- netstat -n
- Do not resolve names
nslookup
- Lookup information from DNS servers
- Canonical names, IP addresses, cache timers, etc.
- Lookup names and IP addresses
- Many different options
net
• Windows network commands
- View network resources
- net view \
- net view /workgroup:
- Map a network share to a drive letter
- net use h: \\
• View user account information and reset passwords
•net user
•net user * /domain
Net user loginname /DOMAIN /active:YES