<# This PowerShell script returns network configuration data similar to that returned by IPConfig. Alan Kaplan www.akaplan.com 12/24/21 #> [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [String] $ComputerName ) Begin { function Out-TextBox2 { [CmdletBinding()] Param ( # StrText help description [Parameter(Mandatory = $true, ValueFromPipeline = $true, Position = 0)] $objIn, # Title help description [Parameter(Mandatory = $False, Position = 1)] [string]$Title = "Results" ) begin { $txt = @() } process { $txt += $objIn } End { $strText = $($txt | Out-String).Trim() Add-Type -AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Drawing $DisplayForm = New-Object System.Windows.Forms.Form $textBox = New-Object System.Windows.Forms.TextBox $System_Drawing_Size = New-Object System.Drawing.Size(800, 550) $DisplayForm.ClientSize = $System_Drawing_Size $DisplayForm.Name = "DisplayForm" $DisplayForm.StartPosition = "CenterScreen" $DisplayForm.Text = $title $DisplayForm.AutoScale = $true $textBox.Dock = 5 $System_Drawing_Point = New-Object System.Drawing.Point(1, 1) $textBox.Location = $System_Drawing_Point $textBox.Multiline = $True $textBox.Name = "textBox" $textBox.ScrollBars = 3 #From above $textBox.Size = $System_Drawing_Size $textBox.TabIndex = 0 $textBox.Text = $strText.trim() $textbox.AutoSize = $true $Font = New-Object System.Drawing.Font("Courier New", 12, [System.Drawing.FontStyle]::Regular) $textBox.Font = $Font #This bit de-selects text in box if ($displayForm.CanFocus) { $DisplayForm.Focus() } else { $DisplayForm.Select() } $DisplayForm.Controls.Add($textBox) $DisplayForm.ShowDialog() | Out-Null } } } Process { Try { $retval = Invoke-Command -ComputerName $computername -ScriptBlock { Get-NetIPConfiguration | Out-String } -ErrorAction stop } Catch { $retval = $error[0].exception.message } } End { $retval | Out-TextBox2 -Title "IP Information from $computername" }