From 090ce67080d800700058247a4074f46207b9d9da Mon Sep 17 00:00:00 2001 From: benpturner Date: Fri, 7 Dec 2018 14:25:22 +0000 Subject: [PATCH] Updated Get-IPAddress --- Modules/Get-IPConfig.ps1 | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/Modules/Get-IPConfig.ps1 b/Modules/Get-IPConfig.ps1 index a754927..e9e6743 100644 --- a/Modules/Get-IPConfig.ps1 +++ b/Modules/Get-IPConfig.ps1 @@ -2,35 +2,30 @@ function Get-Ipconfig { -$array= @() +$array= @() +$wmi=Get-WmiObject win32_ComputerSystem -$wmi=Get-WmiObject win32_ComputerSystem +$obj=New-Object PSObject -$obj=New-Object PSObject - -$obj |Add-Member -MemberType NoteProperty -Name "ComputerName" $wmi.Name - -$obj |Add-Member -MemberType NoteProperty -Name "IPAddress" $IP +$obj |Add-Member -MemberType NoteProperty -Name "ComputerName" $wmi.Name +# Finding the Network Adapter and MAC Address, DHCP Server -# Finding the Network Adapter and MAC Address, DHCP Server - -$wmi=Get-WmiObject win32_networkadapterconfiguration | where {$_.Ipenabled -Match "True"} - -$obj |Add-Member -MemberType NoteProperty -Name "NetworkAdapter" $wmi.description -$obj |Add-Member -MemberType NoteProperty -Name "MACAddress" $wmi.macaddress -$obj |Add-Member -MemberType NoteProperty -Name "DefaultGateway" $wmi.DefaultIPGateway -$obj |Add-Member -MemberType NoteProperty -Name "DHCPServer" $wmi.DHCPServer -$obj |Add-Member -MemberType NoteProperty -Name "DHCPEnabled" $wmi.DHCPEnabled -$obj |Add-Member -MemberType NoteProperty -Name "SubnetMask" $wmi.IPSubnet -$obj |Add-Member -MemberType NoteProperty -Name "DNSServer" $wmi.DnsServerSearchOrder -$obj |Add-Member -MemberType NoteProperty -Name "WinsPrimaryServer" $wmi.WinsPrimaryServer -$obj |Add-Member -MemberType NoteProperty -Name "WinsSecondaryServer" $wmi.WinsSecondaryServer -$array +=$obj +$wmi=Get-WmiObject win32_networkadapterconfiguration | where {$_.Ipenabled -Match "True"} +$obj |Add-Member -MemberType NoteProperty -Name "IPAddress" $wmi.IPAddress +$obj |Add-Member -MemberType NoteProperty -Name "NetworkAdapter" $wmi.description +$obj |Add-Member -MemberType NoteProperty -Name "MACAddress" $wmi.macaddress +$obj |Add-Member -MemberType NoteProperty -Name "DefaultGateway" $wmi.DefaultIPGateway +$obj |Add-Member -MemberType NoteProperty -Name "DHCPServer" $wmi.DHCPServer +$obj |Add-Member -MemberType NoteProperty -Name "DHCPEnabled" $wmi.DHCPEnabled +$obj |Add-Member -MemberType NoteProperty -Name "SubnetMask" $wmi.IPSubnet +$obj |Add-Member -MemberType NoteProperty -Name "DNSServer" $wmi.DnsServerSearchOrder +$obj |Add-Member -MemberType NoteProperty -Name "WinsPrimaryServer" $wmi.WinsPrimaryServer +$obj |Add-Member -MemberType NoteProperty -Name "WinsSecondaryServer" $wmi.WinsSecondaryServer +$array +=$obj echo "[+] IPConfig " echo $array } -