Maintenance tasks for Windows Server Update Services (WSUS) may include moving the downloaded updates or the software update services database (SUSDB) to another directory. You can do this completely from the command line, so this procedure also works under Server Core.

To help manage the constantly growing amount of data on a WSUS server, a server cleanup wizard in the console can remove unneeded updates. However, if (for example) the system has downloaded a large number of updates due to a poor configuration, this tool does not succeed in cleaning up thoroughly and regaining sufficient storage space.

Deleting downloaded updates ^

In this case, it is usually easier to delete the existing downloads. To do this, stop the services for WSUS and IIS with the following PowerShell command:

After removing the entire directory tree below the content folder, start the services again with:

WSUS will then start fetching the currently required updates again. If it doesn't reload the updates automatically, use this command to initiate the download:

Moving the content directory ^

However, if you think there is not enough free space on the volume for the updates, you can move the content directory to a different drive. You can achieve this with the command-line program wsusutil.exe:

If WSUS uses the Windows Internal Database (WID) as the database, this command would set D:\wsus as the new directory for the updates.

Changing the content directory for downloaded updates

Changing the content directory for downloaded updates

But if you use a SQL Server, you additionally have to specify the instance name for WSUS from the command line (even if it doesn't change):

In this example, SUSDB runs on the default instance; therefore, the hostname is sufficient. Otherwise you would have to use the format Server\Instance here. Now you can remove the old content directory and its files.

Moving the WID database to another location ^

If you run the Best Practices Analyzer over a standard installation of WSUS, it will yield a warning if the database is located on the system drive. However, the WSUS setup does not allow you to install it to an alternative location if you use the WID.

The Best Practices Analyzer recommends not storing the WSUS database on the system drive

The Best Practices Analyzer recommends not storing the WSUS database on the system drive

If you want to comply with this recommendation, you can move the database to another drive afterward. To do this, you have to quit the IIS and WSUS services as already mentioned above:

In the next step, you will need a management tool to disconnect the database. The SQL Server Management Studio is suitable for this, but it does not run under Server Core and cannot manage a WID database remotely. Therefore, the example below is based on the command-line program sqlcmd.exe.

If it is not yet available on the server, install the ODBC driver for SQL Server first and then the Command Line Utilities for SQL Server.

Then execute the following command:

The next step is to copy the SUSDB.mdf and SUSDB_log.ldf files from their previous location (the default is %systemroot%\WID\data) to the new location. Now you can reconnect it from there to the database:

In this example, D:\db would be the new directory for SUSDB.

Disconnect SUSDB with sqlcmd and reconnect from a new location

Disconnect SUSDB with sqlcmd and reconnect from a new location

Finally, restart the previously stopped services:

Read 4sysops without ads by becoming a member!

Your question was not answered? Ask in the forum!

2+

Users who have LIKED this post:

  • avatar
Share
0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2020

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account