-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgetnics.ps1
29 lines (22 loc) · 1.11 KB
/
getnics.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$strComputer = "PNYSLPRTWEB01"
$colItems = Get-wmiobject -class "Win32_NetworkAdapterConfiguration" -computername $strComputer | Where{$_.IpEnabled -Match "True"}
foreach ($objItem in $colItems) {
$colAdapter = Get-wmiobject -class "Win32_NetworkAdapter" -computername $strComputer | Where{$_.MACAddress -Match $objItem.MACAddress}
foreach ($objAdapter in $colAdapter) {
write-host "Adapter : " $objAdapter.NetConnectionId
}
write-host "MAC Address : " $objItem.MACAddress
for ($i = 0; $i -le $objItem.IPAddress.getupperbound(0); $i++) {
write-host "IPAddress : " $objItem.IPAddress[$i]
}
write-host "DNS Servers : " $objItem.DNSServerSearchOrder
Write-Host "WINSPrimaryServer:" $objItem.WINSPrimaryServer
Write-Host "WINSSecondaryServer:" $objItem.WINSSecondaryServer
Write-host ""
}
$colRoutes = Get-wmiobject -class "Win32_IP4PersistedRouteTable" -namespace "root\CIMV2" -computername $strComputer
foreach ($objRoute in $colRoutes) {
write-host "route : " $objRoute.Destination
write-host "mask : " $objRoute.Mask
write-host "NextHop : " $objRoute.NextHop
}