rss logo

My Windows commands list

Here are some Windows commands which could be useful inside scripts or in a Server Core environment.

Commands

PS C:\Users\Administrator> net statistics server
PS C:\Users\Administrator> wmic qfe list
PS C:\Users\Administrator> netdom renamecomputer ANCIENNOM /newname:NOUVEAUNOM
PS C:\Users\Administrator> wmic computersystem where name="%computername%" call joindomainorworkgroup name="NOUVEAUNOM"
PS C:\Users\Administrator> netdom join "nom ordinateur" /domain:"monDomaine" /userD:"domaine\utilisateur" /passwordD:"motdepasse"
PS C:\Users\Administrator> tasklist
PS C:\Users\Administrator> taskkill /F /PID "id_processus"

Local User Creation

PS C:\Users\Administrator> net user John "MyPassword!" /ADD
PS C:\Users\Administrator> net localgroup administrators John /add

Firewall

PS C:\Users\Administrator> netsh advfirewall firewall set rule group="Remote Administration" new enable=yes
PS C:\Users\Administrator> netsh advfirewall set current profile settings remotemanagement enable
PS C:\Users\Administrator> cscript %windir%\system32\scregedit.wsf /ar 0
PS C:\Users\Administrator> netsh advfirewall firewall set rule group="Remote Desktop" new enable=yes
PS C:\Users\Administrator> netsh advfirewall show rule name=all
PS C:\Users\Administrator> netsh advfirewall firewall add rule name="SSH" dir=in localport=22 remoteport=0-65535 protocol=TCP action=allow remoteip=any localip=any

Network

PS C:\Users\Administrator> netsh interface ipv4 show interfaces
PS C:\Users\Administrator> netsh interface ipv4 set address name="CARD ID" source="static" address="10.0.0.100" mask="255.0.0.0" gateway="10.0.0.1"
PS C:\Users\Administrator> netsh interface ipv4 add dnsserver name"CARD ID" address=10.0.0.1 index=1
PS C:\Users\Administrator> netsh interface ipv4 set address name="CARD ID" source="dhcp"
PS C:\Users\Administrator> netsh interface ipv4 delete dnsservers "CARD ID" all
PS C:\Users\Administrator> route print
PS C:\Users\Administrator> route add 192.168.1.12 MASK 255.255.255.255 10.8.0.9 METRIC 60
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact :

contact mail address