Ver código fonte

Add 'ChatGPT-HotfixRemover.ps1'

Ethan 2 anos atrás
pai
commit
e8fa676ea1
1 arquivos alterados com 50 adições e 0 exclusões
  1. 50
    0
      ChatGPT-HotfixRemover.ps1

+ 50
- 0
ChatGPT-HotfixRemover.ps1 Ver arquivo

@@ -0,0 +1,50 @@
1
+# Import the necessary assemblies
2
+Add-Type -AssemblyName System.Windows.Forms
3
+Add-Type -AssemblyName System.Drawing
4
+
5
+# Create the Form
6
+$form = New-Object System.Windows.Forms.Form
7
+$form.Text = "Recently Installed Hotfixes"
8
+$form.Width = 500
9
+$form.Height = 250
10
+$form.StartPosition = "CenterScreen"
11
+
12
+# Create the Dropdown Menu
13
+$dropdown = New-Object System.Windows.Forms.ComboBox
14
+$dropdown.Location = New-Object System.Drawing.Point(50,50)
15
+$dropdown.Width = 400
16
+
17
+# Get the Recently Installed Hotfixes
18
+$hotfixes = Get-Hotfix | Select-Object -Property Description, InstalledOn | Sort-Object -Property InstalledOn -Descending
19
+
20
+# Add the Hotfixes to the Dropdown Menu
21
+foreach ($hotfix in $hotfixes) {
22
+    $dropdown.Items.Add("$($hotfix.Description) - Installed On: $($hotfix.InstalledOn)")
23
+}
24
+
25
+# Create the Uninstall Button
26
+$button = New-Object System.Windows.Forms.Button
27
+$button.Text = "Uninstall Selected Hotfix"
28
+$button.Location = New-Object System.Drawing.Point(150,100)
29
+$button.Width = 200
30
+$button.Add_Click({
31
+    # Get the Selected Hotfix
32
+    $selectedHotfix = $dropdown.SelectedItem
33
+    if ($selectedHotfix -eq $null) {
34
+        [System.Windows.Forms.MessageBox]::Show("Please select a hotfix to uninstall.")
35
+    } else {
36
+        # Get the Description and InstalledOn properties of the Selected Hotfix
37
+        $hotfixDetails = $selectedHotfix.Split(" - ")[0]
38
+        $hotfixInstalledOn = $selectedHotfix.Split(" - ")[1]
39
+
40
+        # Uninstall the Selected Hotfix
41
+        Uninstall-WindowsFeature -Name $hotfixDetails -Remove -Restart
42
+    }
43
+})
44
+
45
+# Add the Dropdown Menu and Button to the Form
46
+$form.Controls.Add($dropdown)
47
+$form.Controls.Add($button)
48
+
49
+# Show the Form
50
+$form.ShowDialog()

Powered by TurnKey Linux.