Windows command line reference – Part02
This blog post is continuation from Part01 windows command line reference.
11. List password policy
- net accounts
- net accounts /domain
lists password policy for the system, if system is part of domain then add domain name to command
12. Add IP address
Check for correct adapter settings before running this command
C:\netsh int ip set address “local area connection 2” static 192.168.56.101 255.255.255.0 192.168.56.1 1
netsh int ip set address “interface name” static
- List interfaces
C:\netsh int ipv4 show interfaces
13. Get ip from DHCP
C:\netsh int ip set address “local area connection 2” dhcp
This will request DHCP server for ip address for interface “local area connection 2”
14. Firewall rules
- list all local firewall rules
C:\netsh advfirewall firewall show rule name=all
(lists all firewall rules)
C:\netsh advfirewall firewall show rule name = “File and Printer Sharing (SMB-OUT”)
(listing a particular rule)
More firewall rules can be found here
15. “runas” command usage
C:\runas /u:user command
Ex:
C:\runas /u:user cmd.exe
16. Using netstat
list UDP and TCP ports
- netstat -an
List UDP and TCP ports with Process ID
- netstat -ano
- List UDP and TCP ports with Process ID and programs (requires administrator privilege)
- netstat -abno
- Repeat netstat command
- netstat -ano 1
17. List all services associated with a process
- tasklist /svc
— By Fabian Darius