« Réseau Windows » : différence entre les versions

De Banane Atomic
Aller à la navigationAller à la recherche
Aucun résumé des modifications
 
 
(3 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
[[Category:Windows]]
= CLI =
== Powershell ==
<kode lang='ps'>
# list ip adresses with its interface / adaptor
Get-NetIPAddress
# get adaptor details
Get-NetAdapter -Name 'Adaptor name'
# get the interface index from its name
$InterfaceIndex = Get-NetAdapter | ? InterfaceDescription -like 'xxx*' | select -exp ifIndex
# get the routing table
Get-NetRoute
# get the IPv4 routing table
Get-NetRoute -AddressFamily IPv4
# remove a route
Remove-NetRoute -DestinationPrefix x.x.x.x/y -InterfaceIndex x -NextHop x.x.x.x -RouteMetric x -PolicyStore ActiveStore -Confirm:$false
# add a new route
New-NetRoute -DestinationPrefix x.x.x.x/y -InterfaceIndex x -NextHop x.x.x.x -RouteMetric x -PolicyStore ActiveStore
</kode>
== Batch ==
<kode lang=dos>
<kode lang=dos>
REM toutes les infos
REM toutes les infos
Ligne 5 : Ligne 30 :
REM obtenir le nom d'hôte à partir de l'ip
REM obtenir le nom d'hôte à partir de l'ip
ping -a x.x.x.x
ping -a x.x.x.x
REM get the routing table
route print
</kode>
</kode>
[[Category:Windows]]

Dernière version du 14 décembre 2020 à 16:51

CLI

Powershell

Ps.svg
# list ip adresses with its interface / adaptor
Get-NetIPAddress

# get adaptor details
Get-NetAdapter -Name 'Adaptor name'
# get the interface index from its name
$InterfaceIndex = Get-NetAdapter | ? InterfaceDescription -like 'xxx*' | select -exp ifIndex

# get the routing table
Get-NetRoute
# get the IPv4 routing table
Get-NetRoute -AddressFamily IPv4

# remove a route
Remove-NetRoute -DestinationPrefix x.x.x.x/y -InterfaceIndex x -NextHop x.x.x.x -RouteMetric x -PolicyStore ActiveStore -Confirm:$false

# add a new route
New-NetRoute -DestinationPrefix x.x.x.x/y -InterfaceIndex x -NextHop x.x.x.x -RouteMetric x -PolicyStore ActiveStore

Batch

Dos.svg
REM toutes les infos
ipconfig /all

REM obtenir le nom d'hôte à partir de l'ip
ping -a x.x.x.x

REM get the routing table
route print