Answered by:
Get ipconfig all

Question
-
I'm having difficulty trying to call a list of servers and obtain ipconfig all information on each server output into a csv file. Need DNS servers, Gateway, Subnet mask and IP.Monday, December 11, 2017 2:15 PM
Answers
-
IPCONFIG cannot be run remotely.
The code you posted has nothing to do with IPCONFIG.
Look in Gallery for scripts that remotely return network information.
\_(ツ)_/
- Marked as answer by jrv Monday, December 11, 2017 3:05 PM
Monday, December 11, 2017 2:50 PM
All replies
-
IPCONFIG is a system utility. This is a PowerShell scripting forum.
Please read this first: https://social.technet.microsoft.com/Forums/scriptcenter/en-US/c47b1bc2-f7fd-4d2e-8ff2-e8a81ce090d4/this-forum-is-for-scripting-questions-rather-than-script-requests?forum=ITCG
Also find scripts here: http://gallery.technet.microsoft.com/
Learn PowerShell: https://mva.microsoft.com/en-us/training-courses/getting-started-with-microsoft-powershell-8276
Script requests: https://gallery.technet.microsoft.com/scriptcenter/site/requests
\_(ツ)_/
Monday, December 11, 2017 2:32 PM -
sorry I'm trying to get all this information via Powershell. I understand that IPCONFIG is a system utility.Monday, December 11, 2017 2:38 PM
-
Please post you PowerShell script. For pre-written scripts please look in the gallery link posted above.
\_(ツ)_/
Monday, December 11, 2017 2:42 PM -
thank you, now when i run it all i get is my computer information. I'm needing it to call a txt file and output information to a csv please.
[cmdletbinding()]
param (
[parameter(ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
[string[]]$ComputerName = $env:computername
)
begin {}
process {
foreach ($Computer in $ComputerName) {
if(Test-Connection -ComputerName $Computer -Count 1 -ea 0) {
try {
$Networks = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName $Computer -EA Stop | ? {$_.IPEnabled}
} catch {
Write-Warning "Error occurred while querying $computer."
Continue
}
foreach ($Network in $Networks) {
$IPAddress = $Network.IpAddress[0]
$SubnetMask = $Network.IPSubnet[0]
$DefaultGateway = $Network.DefaultIPGateway
$DNSServers = $Network.DNSServerSearchOrder
$IsDHCPEnabled = $false
If($network.DHCPEnabled) {
$IsDHCPEnabled = $true
}
$MACAddress = $Network.MACAddress
$OutputObj = New-Object -Type PSObject
$OutputObj | Add-Member -MemberType NoteProperty -Name ComputerName -Value $Computer.ToUpper()
$OutputObj | Add-Member -MemberType NoteProperty -Name IPAddress -Value $IPAddress
$OutputObj | Add-Member -MemberType NoteProperty -Name SubnetMask -Value $SubnetMask
$OutputObj | Add-Member -MemberType NoteProperty -Name Gateway -Value $DefaultGateway
$OutputObj | Add-Member -MemberType NoteProperty -Name IsDHCPEnabled -Value $IsDHCPEnabled
$OutputObj | Add-Member -MemberType NoteProperty -Name DNSServers -Value $DNSServers
$OutputObj | Add-Member -MemberType NoteProperty -Name MACAddress -Value $MACAddress
$OutputObj
}
}
}
}
end {}Monday, December 11, 2017 2:47 PM -
IPCONFIG cannot be run remotely.
The code you posted has nothing to do with IPCONFIG.
Look in Gallery for scripts that remotely return network information.
\_(ツ)_/
- Marked as answer by jrv Monday, December 11, 2017 3:05 PM
Monday, December 11, 2017 2:50 PM -
Thanks for the help I'll move on.
- Marked as answer by Chicojrman123 Monday, December 11, 2017 2:55 PM
- Unmarked as answer by jrv Monday, December 11, 2017 3:05 PM
Monday, December 11, 2017 2:55 PM -
How about using Get-NetIPConfiguration? https://docs.microsoft.com/en-us/powershell/module/nettcpip/get-netipconfiguration?view=win10-ps
- Edited by JS2010 Monday, December 11, 2017 9:51 PM
Monday, December 11, 2017 9:51 PM