Clear WSUS disk space

Source: Internet
Author: User


1. You can regularly run server Cleanup Wizard on the WSUS console to perform manual cleanup;


650) This. width = 650; "Title =" 1.png" alt = "wkiom1gisnyhck8haabfv0gtjmu131.png-wh_50" src = "http://s4.51cto.com/wyfs02/M01/89/1F/wKiom1gISnyhcK8HAABfv0GTjMU131.png-wh_500x0-wm_3-wmp_4-s_3187686875.png"/>

650) This. width = 650; "Title =" 2.png" alt = "wKiom1gISo-BEAQVAABKl9_i8bc534.png-wh_50" src = "http://s3.51cto.com/wyfs02/M02/89/1F/wKiom1gISo-BEAQVAABKl9_i8bc534.png-wh_500x0-wm_3-wmp_4-s_1364302809.png"/>


However, using this method has two problems:

1. manual operation is required;

2. if the task is not run for a long time, the duration may be too long due to a large amount of data, or the cleaning may fail;

We recommend that you use this method at least once a month.

Ii. Use PS for automatic plan cleaning;

This method is applicable to Windows Server and later systems. It is cleared by using the powershell invoke-wsusservercleanup command.

 

Invoke-wsusservercleanup [-updateserver <iupdateserver>] [-Snapshot] [-cleanupobsoleteupdates] [-Snapshot] [-compressupdates] [-Snapshot] [-Snapshot] [-Whatif] [- confirm] [<commonparameters>]

 

-Cleanupobsoletecomputers: computers not contactiong the server

(Delete a computer from the database that has not been connected to the specified server for more than 30 days)

-Cleanupobsoleteupdates: unused updates and update revisions

(Delete expired and unapproved updates from the database for more than 30 days, and delete unapproved old version patches for more than 30 days)

-Cleanupunneededcontentfiles: unneeded update files

(Delete the update files required by the server not updated or downstream Update servers from the disk)

-Declineexpi1_pdates: expired updates

(Reject updates not approved or marked by Microsoft as not expired)

-Declinesupersededupdates: superseded updates

(Reject updates that have not been approved for more than 30 days, not currently required by the client and are replaced by approved updates)

-Compressupdates: compresses updates and deletes old versions of identical updates from the database.

-Updateserver: Specify the WSUS server for cleanup. By default, the target WSUS server name can be viewed using get-wsusserver.

 

PS c: \ windows \ system32> Get-wsusserver

Name: bjxxxwsus01

 

The above PS must be run in administrator mode. If the updateserver parameter is not specified, the local server currently running invoke-wsusservercleanup is used by default.

The script for creating wsusclean. PS1 is as follows:

 

Invoke-wsusservercleanup-cleanupobsoletecomputers-cleanupobsoleteupdates-cleanupunneededcontentfiles-compressupdates-declineexpi1_pdates-declinesupersededupdates

 

Place the preceding script in the C-disk scripts directory of the WSUS server (or in other paths, you need to modify the following file path), create a scheduled task, and execute it:

 

Powershell-file "C: \ scripts \ wsusclean. PS1"

 

Note:

1. The WSUS server must enable the policy to allow execution of unsigned scripts.

 

Set-executionpolicy unrestricted

 

Or change:

 

Powershell-executionpolicy unrestricted-file ": \ scripts \ wsusclean. PS1"

 

2. Do not conflict or overlap the definition time of the scheduled task and the synchronization plan time of WSUS.

 

Iii. completely rebuilding the WSUS Service

If the cleanup is not run for a long time, the duration may be too long due to a large amount of data, or the cleanup may fail.

You need to thoroughly uninstall the WSUS service and reinstall the WSUS service. Take WSUS of the local WID database after windowsserver2012 as an example.

1. Uninstall the windowsserverupdateservices service.

650) This. width = 650; "Title =" 3.png" alt = "wkiom1gisqvjzf86aabbr8h8gdc305.png-wh_50" src = "http://s5.51cto.com/wyfs02/M01/89/1F/wKiom1gISqvjzF86AABbR8h8gDc305.png-wh_500x0-wm_3-wmp_4-s_1080145133.png"/>


In the server role, remove all the checked items before widdatabase and wsusservices.

2. uninstall Windows internal database (you need to confirm that no other application is using this service; otherwise, you need to delete the WSUS database using SQL commands)

650) This. width = 650; "Title =" 4.png" alt = "wkiol1gisryhrhomaabci2aaups).png-wh_50" src = "http://s2.51cto.com/wyfs02/M01/89/1C/wKioL1gISryhRhOmAABcI2AauPs425.png-wh_500x0-wm_3-wmp_4-s_4212139243.png"/>


In the function, remove the check box before windowsinternaldatabase.

3. Delete the widdatabase database file (skip this step if Step 2 is not performed)


650) This. width = 650; "Title =" 5.png" alt = "wKiom1gISs7xwhOBAABCp7zp-eU999.png-wh_50" src = "http://s2.51cto.com/wyfs02/M02/89/1F/wKiom1gISs7xwhOBAABCp7zp-eU999.png-wh_500x0-wm_3-wmp_4-s_1279020292.png"/>

Delete the % WinDir % \ WID directory and all its contents.

4. reinstall the WSUS service for configuration.

 

 

 


This article from "fat brother Technology Hall" blog, please be sure to keep this source http://liulike.blog.51cto.com/1355103/1863809

Clear WSUS disk space

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.