Useful Windows Terminal Commands

I’ll try to keep adding to this list.

View Applied Policies with the Command Prompt:

gpresult /Scope User /v
gpresult /Scope Computer /v

Display all IP Addresses and more:

ipconfig                :Basic IP Info
ipconfig /all           :Detailed IP Info including Hostname, DNS & DHCP
ipconfig /release       :Releases your IP Address if you're using DHCP
ipconfig /renew         :Renews your IP Address if you're using DHCP
ipconfig /flushdns      :Purges the DNS Cache
ipconfig /registerdns   :Refreshes all DHCP leases and re-registers DNS names
ipconfig /displaydns    :Displays your DNS Cache

Find what DC the user is logged into from their PC/Laptop/Server:

echo %logonserver%
set l   <-This is an L
nltest /dsgetdc:{domain}

Find what user is logged into the PC/Laptop/Server:

whoami
Get-WMIObject -class Win32_ComputerSystem -ComputerName {domain_name or IP} | Select-Object Name
query user /server:{domain_name or IP}	

Find all the DC in a domain:

nltest /dclist:{domain}

Find the AD OU path for a specific user:

dsquery user -samid kcordero
"CN=Kerry Cordero,OU=Users,OU=HQ,DC=cordero,DC=me"

Find group membership for a specific user:

dsquery user -samid kcordero | dsget user -memberof -expand
"CN=VPN,OU=HQ Distribution Lists,OU=ADSG,OU=HQ,DC=cordero,DC=me"
"CN=BYOD,OU=HQ Distribution Lists,OU=ADSG,OU=HQ,DC=cordero,DC=me"
"CN=Online Storage and Backup,OU=HQ Distribution Lists,OU=ADSG,OU=HQ,DC=cordero,DC=me"
"CN=All Social Media Access,OU=HQ Distribution Lists,OU=ADSG,OU=HQ,DC=cordero,DC=me"
More Stories
Windows AD GPP cpassword Exposure