Managing WSUS from the Command Line
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. |
|
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. |
|
migratesus | This command migrates update approvals from a SUS 1.0 server to a WSUS server. |
|
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 |
|
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. |
|
deleteunneededrevisions | Purges the update metadata for unnecessary update revisions from the database. |
|
listinactiveapprovals | Returns a list of update titles with approvals that are in a permanently inactive state because of a change in server language settings. |
|
removeinactiveapprovals | Removes approvals for updates that are in a permanently inactive state because of a change in WSUS server language settings. |
|
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. |
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. |
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. |
Hinweis
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:
- 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.
- 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.
- 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. |
Syntax
At the command line %drive%\Program Files\Update Services\Tools>, type:
wsusutil deleteunneededrevisions
Wichtig
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