Les commandes CLI Windows

Je vais mettre dans ce document un ensemble de commandes Windows qui pourront être utiles dans la création de scripts ou dans un environement Server Core.

Les commandes

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"

Pare Feu

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

Réseau

PS C:\Users\Administrator> netsh interface ipv4 show interfaces
PS C:\Users\Administrator> netsh interface ipv4 set address name="ID Carte Réseau" 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"ID Carte Réseau" address=10.0.0.1 index=1
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact :