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
| # ==========================================================
# Get-IPConfig.ps1
# Made By : Assaf Miron
# http://assaf.miron.googlepages.com
# Description : Formats the IP Config information into powershell
# ==========================================================
Get-IPConfig
function Get-IPConfig{
param ( $RemoteComputer="LocalHost",
$OnlyConnectedNetworkAdapters=$true
)
gwmi -Class Win32_NetworkAdapterConfiguration -ComputerName $RemoteComputer | Where { $_.IPEnabled -eq $OnlyConnectedNetworkAdapters } | Format-List @{ Label="Computer Name"; Expression= { $_.__SERVER }}, IPEnabled, Description, MACAddress, IPAddress, IPSubnet, DefaultIPGateway, DHCPEnabled, DHCPServer, @{ Label="DHCP Lease Expires"; Expression= { [dateTime]$_.DHCPLeaseExpires }}, @{ Label="DHCP Lease Obtained"; Expression= { [dateTime]$_.DHCPLeaseObtained }}
} |
Partager