45 lines
1.5 KiB
PowerShell
45 lines
1.5 KiB
PowerShell
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
|
|
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
|
|
|
|
$Form = New-Object System.Windows.Forms.Form
|
|
$Form.Size = New-Object System.Drawing.Size(600,400)
|
|
|
|
############################################## Start functions
|
|
|
|
function pingInfo {
|
|
$wks=$InputBox.text;
|
|
$pingResult=ping $wks | fl | out-string;
|
|
$outputBox.text=$pingResult
|
|
} #end pingInfo
|
|
|
|
############################################## end functions
|
|
|
|
############################################## Start text fields
|
|
|
|
$InputBox = New-Object System.Windows.Forms.TextBox
|
|
$InputBox.Location = New-Object System.Drawing.Size(20,50)
|
|
$InputBox.Size = New-Object System.Drawing.Size(150,20)
|
|
$Form.Controls.Add($InputBox)
|
|
|
|
$outputBox = New-Object System.Windows.Forms.TextBox
|
|
$outputBox.Location = New-Object System.Drawing.Size(10,150)
|
|
$outputBox.Size = New-Object System.Drawing.Size(565,200)
|
|
$outputBox.MultiLine = $True
|
|
$outputBox.ScrollBars = "Vertical"
|
|
$Form.Controls.Add($outputBox)
|
|
|
|
############################################## end text fields
|
|
|
|
############################################## Start buttons
|
|
|
|
$Button = New-Object System.Windows.Forms.Button
|
|
$Button.Location = New-Object System.Drawing.Size(400,30)
|
|
$Button.Size = New-Object System.Drawing.Size(110,80)
|
|
$Button.Text = "Ping"
|
|
$Button.Add_Click({pingInfo})
|
|
$Form.Controls.Add($Button)
|
|
|
|
############################################## end buttons
|
|
|
|
$Form.Add_Shown({$Form.Activate()})
|
|
[void] $Form.ShowDialog() |