Yeni jenerasyon Windows işletim sistemlerinin tümünde kullanılabilecek PowerShell temel seviyede olan network komutlarını sizinle paylaşmak isterim.

İlk olarak en çok kullanılan ipconfig komutu ile başlıyorum. Bu komut CMD yada PowerShell ile sunucu yada bilgisayar üzerinde bulunan network kartlarını görüntüleyebilir, üzerinde bulunan IP, subnet, gateway ve mac adreslerini görüntüleyebilirsiniz. En çok bilinen ve kullanılan bir komuttur.

ipconfig /all

PS C:\Users\Administrator> ipconfig /all
 
Windows IP Configuration
 
   Host Name . . . . . . . . . . . . : PowerShell-Test
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
 
Ethernet adapter uplink:
 
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Ethernet Adapter
   Physical Address. . . . . . . . . : 00-**-**-B5-24-8F
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::f07c:9e78:a13:47b0%9(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.2.101(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.2.1
   DHCPv6 IAID . . . . . . . . . . . : 117461078
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-24-19-71-E9-00-50-56-B5-55-FC
   DNS Servers . . . . . . . . . . . : 8.8.8.8
   NetBIOS over Tcpip. . . . . . . . : Enabled
 
Ethernet adapter Ethernet1:
 
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Ethernet Adapter #2
   Physical Address. . . . . . . . . : 00-**-**-B5-85-97
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::ec86:f3c2:2bf3:2530%26(Preferred)
   Autoconfiguration IPv4 Address. . : 169.254.37.48(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.0.0
   Default Gateway . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : 436228182
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-24-19-71-E9-00-50-56-B5-55-FC
   DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Benim sistemim üzerinde iki adet network kartı olduğu için 1. kart üzerinde aktif upilnk bilgilerim. İkinci ethernet kartım bağlı olmadığı için APIPA adresi görülmektedir.

ipconfig komutunun PowerShell karşılığı ise Get-NetIPConfiguration dır.

Get-NetIPConfiguration

PS C:\Users\Administrator> Get-NetIPConfiguration
 
 
InterfaceAlias       : Ethernet1
InterfaceIndex       : 26
InterfaceDescription : Ethernet Adapter #2
NetProfile.Name      : Unidentified network
IPv4Address          : 169.254.37.48
IPv6DefaultGateway   :
IPv4DefaultGateway   :
DNSServer            : fec0:0:0:ffff::1
                       fec0:0:0:ffff::2
                       fec0:0:0:ffff::3
 
InterfaceAlias       : uplink
InterfaceIndex       : 9
InterfaceDescription : Ethernet Adapter
NetProfile.Name      : Network
IPv4Address          : 192.168.2.101
IPv6DefaultGateway   :
IPv4DefaultGateway   : 192.168.2.1
DNSServer            : 8.8.8.8

Sisteminiz üzerinde takılı ethernet kartını görüntülemek için Get-NetAdapter komutunu kullanabilirsiniz.

Get-NetAdapter

PS C:\Users\Administrator> Get-NetAdapter
 
Name                      InterfaceDescription                    ifIndex Status       MacAddress             LinkSpeed
----                      --------------------                    ------- ------       ----------             ---------
Ethernet1                 ******* Ethernet Adapter #2                  26 Up           00-**-**-B5-85-97        10 Gbps
uplink                    ******* Ethernet Adapter                      9 Up           00-**-**-B5-24-8F        10 Gbps

Sadece tek bir kartın özeliklerini görüntülemek isterseniz. Get-NetAdapter -Name *<Ethenet Name>* şeklinde yapabilrisiniz.

Get-NetAdapter -Name *Uplink*

PS C:\Users\Administrator> Get-NetAdapter -Name *Uplink*
 
Name                      InterfaceDescription                    ifIndex Status       MacAddress             LinkSpeed
----                      --------------------                    ------- ------       ----------             ---------
uplink                    ******* Ethernet Adapter                      9 Up           00-**-**-B5-24-8F        10 Gbps

Network kartınızın durumunu, hızını ve Vlan ID görmek isterseniz Get-NetAdapter | ft Name, Status, LinkSpeed, VlanID komutu ile görebilirsiniz.

Get-NetAdapter | ft Name, Status, Linkspeed, VlanID

PS C:\Users\Administrator> Get-NetAdapter | ft Name, Status, Linkspeed, VlanID
 
Name      Status LinkSpeed VlanID
----      ------ --------- ------
Ethernet1 Up     10 Gbps
uplink    Up     10 Gbps

Komutu biraz daha geliştirerek daha fazla detaylı bilgi alabilirsiniz.

PS C:\Users\Administrator> Get-NetAdapter | ft Name, DriverVersion, DriverInformation, DriverFileName, Status, linkspeed
 
Name      DriverVersion DriverInformation                                DriverFileName Status LinkSpeed
----      ------------- -----------------                                -------------- ------ ---------
Ethernet1 1.8.3.1       Driver Date 2018-09-03 Version 1.8.3.1 NDIS 6.30 vmxnet3.sys    Up     10 Gbps
uplink    1.8.3.1       Driver Date 2018-09-03 Version 1.8.3.1 NDIS 6.30 vmxnet3.sys    Up     10 Gbps
 
 
PS C:\Users\Administrator>

Network kartının donanım bilgisi için aşağıdaki komutu kullanabilirsiniz.

Get-NetAdapterHardwareInfo

PS C:\Users\Administrator> Get-NetAdapterHardwareInfo
 
Name                           Segment Bus Device Function Slot NumaNode PcieLinkSpeed PcieLinkWidth Version
----                           ------- --- ------ -------- ---- -------- ------------- ------------- -------
Ethernet1                            0  27      0        0  256               5.0 GT/s            32 1.0
uplink                               0  11      0        0  192               5.0 GT/s            32 1.0

Network kartınızı aktif ve pasif duruma aşağıdaki komutlar ile getirebilirsiniz.

Devre dışı bırakmak için;

Disable-NetAdapter -Name <Ethernet name>

PS C:\Users\Administrator> Disable-NetAdapter -Name Ethernet1
 
Confirm
Are you sure you want to perform this action?
Disable-NetAdapter 'Ethernet1'
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y

Aktif duruma getrimek için;

Enable-NetAdapter -Name Ethernet1

PS C:\Users\Administrator> Enable-NetAdapter -Name Ethernet1
PS C:\Users\Administrator>

Ethernet kartına IP tanımlamak için New-NetIPAdress komutunu kullanabilirsiniz.

New-NetIPAddress -InterfaceAlias Ethernet1 -IPAddress 192.168.1.25 -PrefixLength 24 -DefaultGateway 192.168.1.1

PS C:\Users\Administrator> New-NetIPAddress -InterfaceAlias Ethernet1 -IPAddress 192.168.1.25 -PrefixLength 24 -DefaultGateway 192.168.1.1
 
 
IPAddress         : 192.168.1.25
InterfaceIndex    : 26
InterfaceAlias    : Ethernet1
AddressFamily     : IPv4
Type              : Unicast
PrefixLength      : 24
PrefixOrigin      : Manual
SuffixOrigin      : Manual
AddressState      : Tentative
ValidLifetime     : Infinite ([TimeSpan]::MaxValue)
PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
SkipAsSource      : False
PolicyStore       : ActiveStore
 
IPAddress         : 192.168.1.25
InterfaceIndex    : 26
InterfaceAlias    : Ethernet1
AddressFamily     : IPv4
Type              : Unicast
PrefixLength      : 24
PrefixOrigin      : Manual
SuffixOrigin      : Manual
AddressState      : Invalid
ValidLifetime     : Infinite ([TimeSpan]::MaxValue)
PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
SkipAsSource      : False
PolicyStore       : PersistentStore

Ethernet kartına DNS tanımlamak için Set-DNSClientServer Address komutunu kullanabilirsiniz.

Set-DnsClientServerAddress -InterfaceAlias Ethernet1 -ServerAddresses 192.168.3.1

PS C:\Users\Administrator> Set-DnsClientServerAddress -InterfaceAlias Ethernet1 -ServerAddresses 192.168.3.1
PS C:\Users\Administrator>

Network kartınızın istatistiklerini görmek için get-netadapterstatistics komutunu kullanabilirisniz.

Get-NetAdapterStatistics

PS C:\Users\Administrator> Get-NetAdapterStatistics
 
Name                             ReceivedBytes ReceivedUnicastPackets       SentBytes S
                                                                                      e
                                                                                      n
                                                                                      t
                                                                                      U
                                                                                      n
                                                                                      i
                                                                                      c
                                                                                      a
                                                                                      s
                                                                                      t
                                                                                      P
                                                                                      a
                                                                                      c
                                                                                      k
                                                                                      e
                                                                                      t
                                                                                      s
----                             ------------- ----------------------       --------- -
Ethernet1                            181051237                     30         2686788 1
uplink                              4686021349               12253957      3290675110 0

Detaylı ve gelişmiş olarak network adapter özetini görüntülemek için get-netadapteradvancedproperty komutunu kullanabilirsiniz.

Get-NetAdapterAdvancedProperty

PS C:\Users\Administrator> Get-NetAdapterAdvancedProperty
 
Name                      DisplayName                    DisplayValue                   RegistryKeyword RegistryValue
----                      -----------                    ------------                   --------------- -------------
Ethernet1                 Interrupt Moderation           Enabled                        *InterruptMo... {1}
Ethernet1                 IPv4 Checksum Offload          Rx & Tx Enabled                *IPChecksumO... {3}
Ethernet1                 Jumbo Packet                   Standard 1500                  *JumboPacket    {1514}
Ethernet1                 IPv4 TSO Offload               Enabled                        *LsoV1IPv4      {1}
Ethernet1                 Large Send Offload V2 (IPv4)   Enabled                        *LsoV2IPv4      {1}
Ethernet1                 Large Send Offload V2 (IPv6)   Enabled                        *LsoV2IPv6      {1}
Ethernet1                 Maximum number of RSS Proce... --                             *MaxRssProce... {--}
Ethernet1                 Maximum number of RSS queues   --                             *NumRSSqueues   {--}
Ethernet1                 Priority / VLAN tag            Priority & VLAN Enabled        *PriorityVLA... {3}
Ethernet1                 Recv Segment Coalescing (IPv4) Enabled                        *RscIPv4        {1}
Ethernet1                 Recv Segment Coalescing (IPv6) Enabled                        *RscIPv6        {1}
Ethernet1                 Receive Side Scaling           Enabled                        *RSS            {1}
Ethernet1                 RSS Base Processor Number      --                             *RssBaseProc... {--}
Ethernet1                 Speed & Duplex                 Auto Negotiation               *SpeedDuplex    {0}
Ethernet1                 TCP Checksum Offload (IPv4)    Rx & Tx Enabled                *TCPChecksum... {3}
Ethernet1                 TCP Checksum Offload (IPv6)    Rx & Tx Enabled                *TCPChecksum... {3}
Ethernet1                 UDP Checksum Offload (IPv4)    Rx & Tx Enabled                *UDPChecksum... {3}
Ethernet1                 UDP Checksum Offload (IPv6)    Rx & Tx Enabled                *UDPChecksum... {3}
Ethernet1                 Wake on magic packet           Enabled                        *WakeOnMagic... {1}
Ethernet1                 Wake on pattern match          Enabled                        *WakeOnPattern  {1}
Ethernet1                 Interrupt Coalescing Scheme... Default Scheme                 CoalSchemeMode  {4}
Ethernet1                 Enable adaptive rx ring sizing --                             EnableAdapti... {--}
Ethernet1                 Wake-on-LAN                    Enabled                        EnableWakeOnLan {1}
Ethernet1                 Interrupt Rate                 --                             IntrRate        {--}
Ethernet1                 Rx Ring #1 Size                --                             MaxRxRing1Le... {--}
Ethernet1                 Rx Ring #2 Size                --                             MaxRxRing2Le... {--}
Ethernet1                 Max Tx Queues                  --                             MaxTxQueues     {--}
Ethernet1                 Tx Ring Size                   --                             MaxTxRingLength {--}
Ethernet1                 MAC Address                    --                             NetworkAddress  {--}
Ethernet1                 Large Rx Buffers               --                             NumRxBuffers... {--}
Ethernet1                 Small Rx Buffers               --                             NumRxBuffers... {--}
Ethernet1                 Offload IP Options             Enabled                        OffloadIpOpt... {1}
Ethernet1                 Offload TCP Options            Enabled                        OffloadTcpOp... {1}
Ethernet1                 Offload tagged traffic         Enabled                        OffloadVlanE... {1}
Ethernet1                 Rx Depth                       --                             RxDepth         {--}
Ethernet1                 Receive Throttle               --                             RxThrottle      {--}
Ethernet1                 Receive Throttle for NDIS ALL  --                             RxThrottleOn... {--}
Ethernet1                 Tx Completion Depth            --                             TxCompDepth     {--}
Ethernet1                 Tx Data Descriptor Length      --                             TxDataDescLe... {--}
Ethernet1                 Tx Depth                       --                             TxDepth         {--}
Ethernet1                 VLAN ID                        --                             VlanId          {--}
uplink                    Interrupt Moderation           Enabled                        *InterruptMo... {1}
uplink                    IPv4 Checksum Offload          Rx & Tx Enabled                *IPChecksumO... {3}
uplink                    Jumbo Packet                   Standard 1500                  *JumboPacket    {1514}
uplink                    IPv4 TSO Offload               Enabled                        *LsoV1IPv4      {1}
uplink                    Large Send Offload V2 (IPv4)   Enabled                        *LsoV2IPv4      {1}
uplink                    Large Send Offload V2 (IPv6)   Enabled                        *LsoV2IPv6      {1}
uplink                    Maximum number of RSS Proce... --                             *MaxRssProce... {--}
uplink                    Maximum number of RSS queues   --                             *NumRSSqueues   {--}
uplink                    Priority / VLAN tag            Priority & VLAN Enabled        *PriorityVLA... {3}
uplink                    Recv Segment Coalescing (IPv4) Enabled                        *RscIPv4        {1}
uplink                    Recv Segment Coalescing (IPv6) Enabled                        *RscIPv6        {1}
uplink                    Receive Side Scaling           Enabled                        *RSS            {1}
uplink                    RSS Base Processor Number      --                             *RssBaseProc... {--}
uplink                    Speed & Duplex                 Auto Negotiation               *SpeedDuplex    {0}
uplink                    TCP Checksum Offload (IPv4)    Rx & Tx Enabled                *TCPChecksum... {3}
uplink                    TCP Checksum Offload (IPv6)    Rx & Tx Enabled                *TCPChecksum... {3}
uplink                    UDP Checksum Offload (IPv4)    Rx & Tx Enabled                *UDPChecksum... {3}
uplink                    UDP Checksum Offload (IPv6)    Rx & Tx Enabled                *UDPChecksum... {3}
uplink                    Wake on magic packet           Enabled                        *WakeOnMagic... {1}
uplink                    Wake on pattern match          Enabled                        *WakeOnPattern  {1}
uplink                    Interrupt Coalescing Scheme... Default Scheme                 CoalSchemeMode  {4}
uplink                    Enable adaptive rx ring sizing --                             EnableAdapti... {--}
uplink                    Wake-on-LAN                    Enabled                        EnableWakeOnLan {1}
uplink                    Interrupt Rate                 --                             IntrRate        {--}
uplink                    Rx Ring #1 Size                --                             MaxRxRing1Le... {--}
uplink                    Rx Ring #2 Size                --                             MaxRxRing2Le... {--}
uplink                    Max Tx Queues                  --                             MaxTxQueues     {--}
uplink                    Tx Ring Size                   --                             MaxTxRingLength {--}
uplink                    MAC Address                    --                             NetworkAddress  {--}
uplink                    Large Rx Buffers               --                             NumRxBuffers... {--}
uplink                    Small Rx Buffers               --                             NumRxBuffers... {--}
uplink                    Offload IP Options             Enabled                        OffloadIpOpt... {1}
uplink                    Offload TCP Options            Enabled                        OffloadTcpOp... {1}
uplink                    Offload tagged traffic         Enabled                        OffloadVlanE... {1}
uplink                    Rx Depth                       --                             RxDepth         {--}
uplink                    Receive Throttle               --                             RxThrottle      {--}
uplink                    Receive Throttle for NDIS ALL  --                             RxThrottleOn... {--}
uplink                    Tx Completion Depth            --                             TxCompDepth     {--}
uplink                    Tx Data Descriptor Length      --                             TxDataDescLe... {--}
uplink                    Tx Depth                       --                             TxDepth         {--}
uplink                    VLAN ID                        --                             VlanId          {--}