Windows Environment Commands

Windows Environment Commands

  • Change Proxy via Command


netsh winhttp set proxy proxy-server="proxy.:8080"
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]

reg import filename.reg

  • KMS Activation

KMS Keys –


cscript //B "%windir%\system32\slmgr.vbs" -ckms
 cscript //B "%windir%\system32\slmgr.vbs" -skms [kms_server_name]:1688
 Find KMS Server - nslookup -type=srv _vlmcs._tcp
 cscript //B "%windir%\system32\slmgr.vbs" -skms –ipk <kms key>
 cscript //B "%windir%\system32\slmgr.vbs" -skms –ato

  • Find User Account with ForeignSecurityPrincipal / SAMID

$pw = read-host "Enter password" -AsSecureString
 connect-QADService -service '*' -ConnectionAccount 'domain\username' -ConnectionPassword $pw
 (get-QADObject -identity 'S-1-5....').DirectoryEntry.description

  • Show SAMID of user account

dsquery * -filter "&(objectcategory=user)(samaccountname=accountname)" -attr objectsid
 dsquery * -filter "&(objectcategory=user)(samaccountname=*)" -attr objectsid -limit 100000000
 dsget user "cn=username,OU=,DC=corpau,DC=com,DC=au" -sid

netsh int ipv4 show dynamicport tcp
netsh int ipv4 show dynamicport udp
netsh int ipv4 set dynamicport tcp start=10000 num=1000
netsh int ipv4 set dynamicport udp start=10000 num=1000

  • Find domain controllers
netdom query dc
  • Windows Update

net stop wuauserv

wmic qfe list full /format:htable | findstr "KB2621440"

wmic qfe list full | findstr "KB2621440"

  • KMS

cscript //B "%windir%\system32\slmgr.vbs" -ckms
 cscript //B "%windir%\system32\slmgr.vbs" -skms
 Find KMS Server - nslookup -type=srv _vlmcs._tcp

  • Dsgets

dsquery ou domainroot

dsquery user -name Ja*

dsget uer CN=*,CN=*,DC=*,DC=*,DC=*,DC=com,DC=au -memberof -expand

dsquery user -name *| dsget user -memberof -expand

dsquery "DC=com,DC=au"  | dsget group -members

  • Systeminfo

systeminfo /S A* /U /P  findstr  "Processor"

WMIC CPU Get NumberOfCores,NumberOfLogicalProcessors /Format:List

WMIC CPU Get /Format:List

  • NSanity
c:\nsanity.exe -S snapmanager windows://ServerName
  • nmap
nmap -vv -P0 -sU -p123
  • Find Domain controllers

<strong>dsquery server</strong><strong> -hasfsmo</strong><strong> pdc</strong>

netdom query /d:domain pdc or dc


Windows 7 Backup Image Restore

IMPORTANT: Windows 7 Image Restore only restore the partition that the C: drive system files are located on. You will need to backup all other partitions to another physical location or media.

Backup the Workstation

1. Type SDCLT.exe in the RUN box to bring up the Backup and Restore program

2. Create a Full backup of all Partitions and SYSTEM STATE to another media

3. Create a System Repair Image

4. Burn System Image Backup to a DVD

5. Boot with System Restore CD

6. Select Restore from Image and Insert you Image Backup DVD

7. Boot to Windows and Restore all other volume..

Reference Links :