[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=Test-Connection -ComputerName $wks -Count 1 | out-string; $outputBox.text=$pingResult } #end pingInfo ############################################## end functions Function NA-GetHardDriveInfo { $Computer = $InputBox.Text $HDInfo = Gwmi Win32_logicaldisk -ComputerName $Computer -Filter "Drivetype = '3'" | ft -AutoSize | Out-String $outputBox.Text = $HDInfo } ############################################## Start text fields Function NA-GetProcess { $Computer = $InputBox.Text $Proc = Get-Process -ComputerName $Computer | % { $Obj = New-Object -TypeName PSObject $Obj | Add-Member -MemberType NoteProperty -Name Handles -Value $_.handles $Obj | Add-Member -MemberType NoteProperty -Name NPM -Value $_.npm $Obj | Add-Member -MemberType NoteProperty -Name PM -Value $_.pm $Obj | Add-Member -MemberType NoteProperty -Name WS -Value $_.WS $Obj | Add-Member -MemberType NoteProperty -Name VM -Value $_.vm $Obj | Add-Member -MemberType NoteProperty -Name CPU -Value $_.cpu $Obj | Add-Member -MemberType NoteProperty -Name ID -Value $_.ID $Obj | Add-Member -MemberType NoteProperty -Name ProcessName -Value $_.ProcessName $Obj } $outputBox.Text = $Proc } ############################################## end functions $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(80,20) $Button.Text = "Ping" $Button.Add_Click({pingInfo}) $Form.Controls.Add($Button) ############################################## end buttons $Button_HDrive = New-Object System.Windows.Forms.Button $Button_HDrive.Location = New-Object System.Drawing.Size(400,50) $Button_HDrive.Size = New-Object System.Drawing.Size(80,20) $Button_HDrive.Text = "Hard Drive" $Button_HDrive.Add_Click({NA-GetHardDriveInfo}) $Form.Controls.Add($Button_HDrive) ############################################## end button_HDrive $Button_Proc = New-Object System.Windows.Forms.Button $Button_Proc.Location = New-Object System.Drawing.Size(400,70) $Button_Proc.Size = New-Object System.Drawing.Size(80,20) $Button_Proc.Text = "Processes" $Button_Proc.Add_Click({NA-GetProcess}) $Form.Controls.Add($Button_Proc) $Form.Add_Shown({$Form.Activate()}) [void] $Form.ShowDialog()