Share via


Managing WSUS from the Command Line

Applies To: Windows Server Update Services

This topic does the following

  • Summarizes the purpose and functionality of WSUSutil.exe and its parameters.

  • Provides and defines the syntax you would use to run specific tasks.

  • Links to "Deploying Microsoft Windows Server Update Services" where more information (for example, scenarios) is available.

Running WSUSutil.exe

WSUSutil.exe is a tool that you can use to manage your WSUS server from the command line. WSUSutil.exe is located in the %drive%\Program Files\Update Services\Tools folder on your WSUS server. You can run specific commands with WSUSutil.exe to perform specific functions, as summarized in the following table. The syntax you would use to run WSUSutil.exe with specific commands follows the table.

Summary of Commands You Can Use with WSUSutil

Command What it enables you to do When you might use it

export

The first of the two parts that make up the export / import process.

The export command enables you to export update metadata to an export package file. You cannot use this parameter to export update files, update approvals, or server settings.

  • On an ongoing basis, if you are running a network with limited or restricted Internet connectivity

import

The second of the two parts that make up the export/import process.

The import command imports update metadata to a server from an export package file created on another WSUS server. This synchronizes the destination WSUS server without using a network connection.

  • On an ongoing basis, if you are running a network with limited or restricted connectivity

migratesus

This command migrates update approvals from a SUS 1.0 server to a WSUS server.

  • If you are upgrading your implementation SUS 1.0 to WSUS.

movecontent

Changes the file system location where the WSUS server stores update files, and optionally copies any update files from the old location to the new location

  • Hard drive is full

  • Disk fails

reset

Checks that every update metadata row in the database has corresponding update files stored in the file system. If update files are missing or have been corrupted, WSUS downloads the update files again.

  • After restoring the WSUS database.

  • When troubleshooting

deleteunneededrevisions

Purges the update metadata for unnecessary update revisions from the database.

  • To free up space when an MSDE is full

listinactiveapprovals

Returns a list of update titles with approvals that are in a permanently inactive state because of a change in server language settings.

  • When you change language settings on an upstream server (that is the parent to a replica server) and want to see which updates are no longer active because they are not in the new languages you have specified. You can run this command if you want to see a list of inactive approvals (for example, to help you decide if you want to remove the inactive approvals). You do not have to run this command before running the removeinactiveapprovals command.

removeinactiveapprovals

Removes approvals for updates that are in a permanently inactive state because of a change in WSUS server language settings.

  • When you change language settings on an upstream server (that is the parent to a replica server) and want to remove updates that are no longer active because they are not in the new languages you have specified. This would fix the resulting mismatch in the number of updates displayed on the parent and replica servers in this scenario. You do not have to run the listinactiveapprovals command before running this command.  

Export

For background and procedural information about exporting and importing updates, see "Set Up a Disconnected Network (Import and Export Updates)" in Deploying Microsoft Windows Server Update Services at https://go.microsoft.com/fwlink/?linkid=41777.

Syntax

At the command line %drive%\Program Files\Update Services\Tools>, type:

wsusutil export package logfile

The parameters are defined in the following table.

Parameter Definition

package

The path and file name of the package .cab to create.

logfile

The path and file name of the log file to create.

/help or /?

Displays command-line help for export command.

Import

For background and procedural information about exporting and importing updates, see "Set Up a Disconnected Network (Import and Export Updates)" in Deploying Microsoft Windows Server Update Services at https://go.microsoft.com/fwlink/?linkid=41777.

Syntax

At the command line %drive%\Program Files\Update Services\Tools>, type:

wsusutil import package logfile

The parameters are defined in the following table:

Parameter Definition

package

The path and file name of the package .cab to import.

logfile

The path and file name of the log file to create.

/help or /?

Displays command-line help for import command.

Migratesus

SUS 1.0 to WSUS migration scenarios and related procedures are covered extensively in the "Migrate from a SUS Server to a WSUS Server" topic in Deploying Microsoft Windows Update Services at https://go.microsoft.com/fwlink/?LinkID=41777.

Syntax

At the command line %drive%\Program Files\Update Services\Tools>, type:

wsusutil migratesus [/content contentshare] [/approvals servername [computergroup]] [/log logfile] [/?]

The parameters are defined in the following table:

Parameter Definition

/content contentshare

Migrates content from a SUS 1.0, where contentshare is the path to the folder that contains SUS 1.0 content.

/approvals servername

Migrates approvals from the SUS 1.0 server, where servername is the name of the SUS 1.0 server.

computergroup

Computer group for which you want to apply the approvals.

/help or /?

Displays command-line help for the migratesus parameter.

/log logfile

File in which migration activities are logged.

Movecontent

When you run this command, WSUSutil.exe does the following:

  • Copies the update files from the old location into the new location.

  • Updates the WSUS database to refer to the new location of the update files.

The destination folder where update files are moved to must be on an NTFS partition. The content move tool will not try to copy update files if they already exist in the destination folder. WSUSutil.exe sets the same permissions on the destination folder that were set on the original folder.

Note

You can use xcopy, the Backup utility, or other non-WSUS specific methods to copy update files from the old location into the new one. If you copy the files by using a method other than WSUSutil.exe, you still need to run WSUSutil.exe to perform the second part of the move. In this case you would use the skipcopy parameter when running WSUSutil.exe. See "Syntax" below for more information.

There are two scenarios in which you might move update files from one WSUS drive to another:

  • If the drive is full

  • If the hard disk fails

If the drive is full

If the drive where WSUS stores update files is full, you can do one of the following:

  • Add more space to your current drive by using NTFS functionality. This is done without using WSUSutil.exe. This method does not affect WSUS configuration or operation.

  • Install a new drive, and then move the update files from the old drive to the new location by using Wsusutil.exe.

If the hard disk fails

If the hard disk that stores update files fails, you must do the following:

  1. Install the new disk on your computer, and then restore the update files from your backup files. Note: If you have not backed up your update files, WSUSutil.exe downloads the missing files at the end of the content move operation.

  2. Run the content move operation, specifying the location for the new disk. In addition, you specify the skipcopy parameter, because you are either putting the files in the new folder through the Backup utility or the source folder does not exist; the update files will be downloaded at the end of this process.

  3. When the move operation is complete, all the missing files are downloaded.

Syntax

At the command line *%drive%\*Program Files\Update Services\Tools>, type:

wsusutil movecontent contentpath logfile -skipcopy [/?]

The parameters are defined in the following table.

Parameter Definition

contentpath

The new root for content files. The path must exist.

logfile

The path and file name of the log file to create.

-skipcopy

Indicates that only the server configuration should be changed, and that the content files should not be copied.

/help or /?

Displays command-line help for movecontent command.

Reset

You use this command if you store updates locally on your WSUS server and want to ensure that the metadata information stored in your WSUS database is accurate. With this command, you verify that every update metadata row in the WSUS database corresponds to update files stored in the local update file storage location on your WSUS server. If update files are missing or have been corrupted, WSUS downloads the update files again. This command might be useful to run after you restore your database, or as a first step when troubleshooting update approvals.

Syntax

At the command line %drive%\Program Files\Update Services\Tools>, type:

wsusutil reset

Deleteunneededrevisions

If you use an MSDE database in your WSUS implementation (for example, if you are using WSUS on a server running Windows 2000), you might need to run this command periodically when the database reaches its 2-GB limit because once the database is full, you cannot synchronize new updates to your server, add new computers, or import events from existing client computers.

With regular use, it is possible that the 2 GB will be reached quickly, as updates can be very large, and update publishers typically create multiple revisions of each update, which your server will synchronize automatically for the products and update classifications you specify. In addition, event information for client computers also populates the database. When your MSDE database is close to reaching its limit, you will receive a notification on the WSUS console Home page alerting you to run this command soon. When you run this command, unneeded revisions and the events associated with those revisions are deleted from the database.

Unneeded revisions are revisions to software or drivers updates that have not been deployed to a computer group in at least one month; they are also the latest revisions to expired driver updates that have not been deployed to a computer group for at least one month. The one-month time period in both of these cases can be changed, indirectly. It automatically gets reduced by 7 to 15 days if you reduce the size of a database that is larger than 1 GB by less than 25 percent in the process of running this command.

Note

For more information about the databases you can use with WSUS, see the "Choose the Database Used for WSUS" topic in Deploying Microsoft Windows Update Services at https://go.microsoft.com/fwlink/?LinkID=41777.

Syntax

At the command line %drive%\Program Files\Update Services\Tools>, type:

wsusutil deleteunneededrevisions

Important

Before running this command, you must stop the World Wide Web publishing service in IIS. You must restart it only after you have finished running this command. To stop or start the IIS service, open IIS, navigate to and then right-click the Web site where WSUS is is installed (by default this is the Default Web Site), and then click Stop or Start.

Listinactiveapprovals

If you change language options on an upstream WSUS server, you can create a situation where the number of updates approved on a parent upstream server does not match the number of approved updates on a replica server.

Here is a scenario where this might occur:

You have configured your upstream parent server to synchronize from Microsoft Update and have left the language setting set to All Languages (the default). You then run synchronization and approve 300 updates, of which 50 are not English language updates. You then change the language setting on the server to English only. After this, a replica server synchronizes from the parent upstream server and downloads only the "active" approvals, which now are only the English language ones (replica servers always only synchronize active approvals). At this point, if you look on the WSUS console on the parent server, you will see that 300 updates are approved. If you do the same on the replica server, you will see that only 250 are approved. You would use listinactiveapprovals to see a list of the updates on the parent upstream server that are permanently inactive—in this case, you would see the 50 updates that are not English. You can run this command if you want to see a list of the inactive approvals (for example, to help you decide if you want to remove the inactive approvals). You do not have to run this command before running the removeinactiveapprovals command.  

Syntax

At the command line %drive%\Program Files\Update Services\Tools>, type:

wsusutil listinactiveapprovals

Removeinactiveapprovals

The scenario in which you would use this command is the same as the one described for listinactiveapprovals. However, while you use listinactiveapprovals to list the inactive approvals on the parent upstream server, you use removeinactiveapprovals to remove them. You do not have to run the listinactiveapprovals command before running this command.  

Syntax

At the command line %drive%\Program Files\Update Services\Tools>, type:

wsusutil removeinactiveapprovals