# Uninstall Windows Updates

## PowerShell Script

The following is the **Uninstall Windows Update** **KB** **5000802** sample PowerShell script. Copy it and save it as a **.ps1** file or download it from here [http://faronics.org/proservices/UninstallWU.ps1.](http://faronics.org/proservices/UninstallWU.ps1)

```
wusa /uninstall /kb:5000802 /quiet /forcerestart
```

{% hint style="danger" %}
Note that this example is **specific** to **KB 5000802**; you will need to **replace** the Patch **KB Number** with the **Patch KB Number** of the **Windows Update** that you wish to **uninstall**.
{% endhint %}

1\. Edit the script to replace the Patch **KB Number** (5000802 in the example above) with the **Patch KB Number** to be uninstalled.

2\. **Optional:** Remove **/forcerestart** from the script to prevent an instant restart.

{% hint style="info" %}
It's recommended that the **/forcerestart** remains in the script but it is not mandatory.
{% endhint %}

3\. Save the script as a **.ps1** file.

4\. Self-host the script - see [Quick Guide to Self-Hosting Custom Scripts](https://docs.faronics.com/faronicsdeploy/custom-scripts-powershell-vb-batch/custom-scripts-library/quick-guide-to-self-hosting-custom-scripts).&#x20;

## Custom Script Settings

The table below outlines all the fields that need to be set when creating this custom script.&#x20;

{% hint style="info" %}
For a detailed guide, refer to [Create a Custom Script to Uninstall a Windows Update via KB Number Custom Script](#create-a-custom-script-to-uninstall-a-windows-update-via-kb-number).
{% endhint %}

| Field        | Value                                                                         |
| ------------ | ----------------------------------------------------------------------------- |
| Name         | **Uninstall Windows Update KB 5000802**                                       |
| URL          | <https://raw.githubusercontent.com/murtaza7869/Deploy/master/UninstallWU.ps1> |
| Type         | **PowerShell**                                                                |
| Command-Line | Leave blank                                                                   |
| Run As       | **System Account** or **Specified User Account**                              |

{% hint style="danger" %}
Please note this **example URL** is **specific** to **KB 5000802**; you will need to download and edit the script **replacing** the **KB number** and self-host if you haven't already done so (see [Quick Guide to Self-Hosting Custom Scripts](https://docs.faronics.com/faronicsdeploy/custom-scripts-powershell-vb-batch/custom-scripts-library/quick-guide-to-self-hosting-custom-scripts) for further info).
{% endhint %}

## Create a Custom Script to Uninstall a Windows Update via KB Number

![Create a Custom Script](https://3007061244-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MRkQfx_2cLnNNBX1muO%2F-MVTElzvvVzBy4ilZBk4%2F-MVTMQo7yXAzeNjC65UE%2Fimage.png?alt=media\&token=7a0a3ba4-1ce4-4768-af51-34d6956c7572)

1\. Select the **Control Grid** tab on the top menu bar.

2\. Navigate to the **Applications** tab.

3\. Click **CUSTOM** **SCRIPT**.

4\. Select **Create** **Custom** **Script**.

5\. Enter a **Name** for the script; **Uninstall Windows Update KB 5000802** in this example; use any name you'd like to use.

![](https://3007061244-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MRkQfx_2cLnNNBX1muO%2F-MX3iGoZW9PW4rUonEpe%2F-MX3mJnxVYLnwSkPyMP_%2Fimage.png?alt=media\&token=77b69742-9c2b-473a-b5d9-6293fff793c1)

6\. Enter the **URL** that points to the hosted script <https://raw.githubusercontent.com/murtaza7869/Deploy/master/UninstallWU.ps1> in this example.&#x20;

{% hint style="danger" %}
Please note this **example URL** is **specific** to **KB 5000802**; you will need to download and edit the script **replacing** the Patch **KB number**, and self-host it if you haven't already done so.
{% endhint %}

{% hint style="info" %}
You can self-host for free using GitHub. See the [Quick Guide to Self-Hosting Custom Scripts](https://docs.faronics.com/faronicsdeploy/custom-scripts-powershell-vb-batch/custom-scripts-library/quick-guide-to-self-hosting-custom-scripts) for further information.&#x20;

Note: When self-hosting, you might need to whitelist the URL in your firewall.
{% endhint %}

7\. Select the script type: **Powershell**.

8\. **Command Line**: Leave blank.

9\. Select the account to **Run As**; either **System Accoun**t or **Specified User Account**.

10\. Click **SAVE TO GRID**.

{% hint style="info" %}
Once saved, the script can be pushed to an individual computer or groups of computers. It can also be scheduled using a Policy.

For a guide on how to run your custom script, see [Pushing the Script](https://docs.faronics.com/faronicsdeploy/custom-scripts-powershell-vb-batch/..#pushing-the-script).
{% endhint %}

{% hint style="success" %}
The script will now appear in the list of Custom Scripts. It will also be available to select from the Applications Control Grid View.&#x20;

Search for the script in the grid using the search option. If your applications are grouped, you will see a column named **Custom** **Scripts**. Selecting the **Custom Script header** will display all the scripts that have been added to the grid.&#x20;
{% endhint %}
