Intune Initial Scripts Backup
This commit is contained in:
45
dump/SCCM-Tool/Forms/Form-Examples/Form-Test-button.ps1
Normal file
45
dump/SCCM-Tool/Forms/Form-Examples/Form-Test-button.ps1
Normal file
@@ -0,0 +1,45 @@
|
||||
[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()
|
||||
Reference in New Issue
Block a user