· 5 years ago · Oct 07, 2020, 05:06 PM
1<# This form was created using POSHGUI.com a free online gui designer for PowerShell
2.NAME
3 Untitled
4#>
5
6Add-Type -AssemblyName System.Windows.Forms
7Import-Module PSWorkflow
8[System.Windows.Forms.Application]::EnableVisualStyles()
9
10$4peopleTestForm = New-Object system.Windows.Forms.Form
11$4peopleTestForm.ClientSize = New-Object System.Drawing.Point(850,650)
12$4peopleTestForm.text = "4people Test Script"
13$4peopleTestForm.TopMost = $false
14
15$startButton = New-Object system.Windows.Forms.Button
16$startButton.text = "Go"
17$startButton.width = 179
18$startButton.height = 54
19$startButton.location = New-Object System.Drawing.Point(319,17)
20$startButton.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
21
22$result = New-Object system.Windows.Forms.TextBox
23$result.multiline = $true
24$result.width = 820
25$result.height = 500
26$result.location = New-Object System.Drawing.Point(11,124)
27$result.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
28
29$4peopleTestForm.controls.AddRange(@($startButton,$result))
30$startButton.Add_Click({ run })
31
32
33$result.AppendText("initalizated")
34
35$siteUrls = "google.de"#, "google.com", "google.ru", "ya.ru", "yandex.ru"
36
37workflow Test-Flow {
38 param (
39 $urls
40 )
41 foreach -parallel ($item in $urls) {
42 Write-Output "Processing $item"
43 Test-NetConnection $item -TraceRoute
44 }
45}
46
47function run {
48 $j = Test-Flow $siteUrls -AsJob
49 Write-Host "Job started"
50 while ($j.State -eq "Running") {
51 $z = Receive-Job $j
52 $result.AppendText($j)
53 Start-Sleep -Seconds 1
54}
55}
56
57
58[void]$4peopleTestForm.ShowDialog()