Get-RemoteIPSettings.ps1
19 Sep 2025Description
Purpose
Retrieves remote computer IP configuration details.
Detailed Description
Get-RemoteIPSettings uses PowerShell remoting to fetch network settings such as IP addresses, default gateways, and DNS server addresses from one or more remote computers.
Usage
Example 1
Get-RemoteIPSettings -ComputerName "Server01","Server02" -Credential (Get-Credential)
Notes
Ensure that PowerShell remoting is enabled on the target computers. This function is as remote as it gets—bringing your network details right to your console!
Script
<#
.SYNOPSIS
Retrieves remote computer IP configuration details.
.DESCRIPTION
Get-RemoteIPSettings uses PowerShell remoting to fetch network settings such as IP addresses,
default gateways, and DNS server addresses from one or more remote computers.
.EXAMPLE
Get-RemoteIPSettings -ComputerName "Server01","Server02" -Credential (Get-Credential)
.NOTES
Ensure that PowerShell remoting is enabled on the target computers.
This function is as remote as it gets—bringing your network details right to your console!
#>
function Get-RemoteIPSettings {
[CmdletBinding()]
param(
# One or more target computer names
[Parameter(Mandatory = $true, ValueFromPipeline = $true, Position = 0)]
[string[]]$ComputerName,
# Optional credentials if needed for remote access
[Parameter(Mandatory = $false)]
[System.Management.Automation.PSCredential]$Credential
)
process {
foreach ($computer in $ComputerName) {
try {
Write-Verbose "Connecting to $computer..."
# Prepare the parameters for Invoke-Command
$invokeParams = @{
ComputerName = $computer
ScriptBlock = {
# Retrieve network configuration and format the output
Get-NetIPConfiguration | ForEach-Object {
[PSCustomObject]@{
InterfaceAlias = $_.InterfaceAlias
IPv4Address = ($_.IPv4Address | ForEach-Object { $_.IPAddress }) -join ', '
IPv6Address = ($_.IPv6Address | ForEach-Object { $_.IPAddress }) -join ', '
DefaultGateway = ($_.IPv4DefaultGateway | ForEach-Object { $_.NextHop }) -join ', '
DNSServers = ($_.DNSServer.ServerAddresses) -join ', '
}
}
}
ErrorAction = 'Stop'
}
if ($Credential) {
$invokeParams.Credential = $Credential
}
$results = Invoke-Command @invokeParams
Write-Output $results
}
catch {
Write-Warning "Failed to retrieve IP settings from $computer. Error: $_"
}
}
}
}
Download
Please feel free to copy parts of the script or if you would like to download the entire script, simply click the download button. You can download the complete repository in a zip file by clicking the Download link in the menu bar on the left hand side of the page.
Report Issues
You can report an issue or contribute to this site on GitHub. Simply click the button below and add any relevant notes. I will attempt to respond to all issues as soon as possible.