/
CiscoJabberTaskKill.ps1
60 lines (50 loc) · 1.6 KB
/
CiscoJabberTaskKill.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Adding assemblies
Add-Type -AssemblyName System.Windows.Forms
# Creating Forms Form
$TaskKiller = New-Object System.Windows.Forms.Form
$TaskKiller.Text = "Taskkiller for <ciscojabber.exe> - $env:COMPUTERNAME - $env:USERNAME"
$TaskKiller.BackColor = "#D1C336"
$TaskKiller.TopMost = $true
$TaskKiller.Width = 400
$TaskKiller.Height = 120
# Creating Label
$Label = New-Object system.windows.Forms.Label
$Label.Width = 600
$Label.Height = 20
$Label.Location = New-Object System.Drawing.Point(10,10)
$Label.Font = "Times New Roman,12"
$Label.Text = "Please enter your Hostname below"
# Creating TextBox
$HostField = New-Object System.Windows.Forms.TextBox
$HostField.Multiline = $false
$HostField.BackColor = "#ffffff"
$HostField.Width = 120
$HostField.Height = 20
$HostField.Location = New-Object System.Drawing.Point(13,38)
$HostField.Font = "Times New Roman,12"
# Creating Button
$KillButton = New-Object System.Windows.Forms.Button
$KillButton.BackColor = "#929195"
$KillButton.Text = "Kill"
$KillButton.Width = 50
$KillButton.Height = 26
$KillButton.Location = New-Object System.Drawing.Point(135,38)
$KillButton.Font = "Times New Roman,12"
# Add Objects to Form
$TaskKiller.Controls.Add($Label)
$TaskKiller.Controls.Add($HostField)
$TaskKiller.Controls.Add($KillButton)
# Action for Kill button
$Button_Click = {
taskkill.exe /IM ciscojabber.exe /s $HostField.Text
Start-Sleep 2
}
# Focus on Text Field & perform actions
$HostField.Focus()
$KillButton.Add_Click($Button_Click)
# Starting & Stopping Form
[void]$TaskKiller.ShowDialog()
$TaskKiller.Dispose()
<# Credits: easycalculation.com
poshgui.com
#>