Edit

Share via


Invoke-WsusServerCleanup

Performs the process of cleanup on a WSUS server.

Syntax

Default (Default)

Invoke-WsusServerCleanup
    [-UpdateServer <IUpdateServer>]
    [-CleanupObsoleteComputers]
    [-CleanupObsoleteUpdates]
    [-CleanupUnneededContentFiles]
    [-CompressUpdates]
    [-DeclineExpiredUpdates]
    [-DeclineSupersededUpdates]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Invoke-WsusServerCleanup cmdlet performs the process of cleanup on a specified Windows Server Update Services (WSUS) server. This process has the same impact as running the Cleanup Wizard from within the WSUS Console application and allows the specification of the same options as parameters.

Examples

Example 1: Run cleanup for obsolete computers

PS C:\> Get-WsusServer | Invoke-WsusServerCleanup -CleanupObsoleteComputers
Obsolete Computers Deleted: 1

This command runs this cmdlet on the local WSUS server specifying the option to clean up obsolete computers.

Example 2: Run cleanup for obsolete computers and updates

PS C:\> Get-WsusServer "contoso" | Invoke-WsusServerCleanup -CleanupObsoleteComputers -CleanupObsoleteUpdates
Obsolete Updates Deleted: 62
Obsolete Computers Deleted: 0

This command runs this cmdlet on the server named contoso specifying the options to clean up obsolete computers and obsolete updates.

Parameters

-CleanupObsoleteComputers

Specifies that the cmdlet deletes obsolete computers from the database.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CleanupObsoleteUpdates

Specifies that the cmdlet deletes obsolete updates from the database.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CleanupUnneededContentFiles

Specifies that the cmdlet deletes unneeded update files.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CompressUpdates

Specifies that the cmdlet deletes obsolete revisions to updates from the database.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DeclineExpiredUpdates

Specifies that the cmdlet declines expired updates.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DeclineSupersededUpdates

Specifies that the cmdlet declines superseded updates.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-UpdateServer

Specifies the object that contains the WSUS server. This value is obtained by calling the Get-WsusServer cmdlet and passing the resulting IUpdateServer object into this cmdlet.

Parameter properties

Type:IUpdateServer
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

Microsoft.UpdateServices.Commands.IUpdateServer

Outputs

None