< Back

Invoke-WsusServerCleanup

Thu Apr 04, 2019 5:42 am

NAME Invoke-WsusServerCleanup



SYNOPSIS

Performs the process of cleanup on a WSUS server.





SYNTAX

Invoke-WsusServerCleanup [-CleanupObsoleteComputers] [-CleanupObsoleteUpdates] [-CleanupUnneededContentFiles] [-CompressUpdates]

[-DeclineExpiredUpdates] [-DeclineSupersededUpdates] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}]

[-InformationVariable <System.String>] [-UpdateServer <IUpdateServer>] [-Confirm] [-WhatIf] [<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.





PARAMETERS

-CleanupObsoleteComputers [<SwitchParameter>]

Specifies that the cmdlet deletes obsolete computers from the database.



Required? false

Position? named

Default value none

Accept pipeline input? false

Accept wildcard characters? false



-CleanupObsoleteUpdates [<SwitchParameter>]

Specifies that the cmdlet deletes obsolete updates from the database.



Required? false

Position? named

Default value none

Accept pipeline input? false

Accept wildcard characters? false



-CleanupUnneededContentFiles [<SwitchParameter>]

Specifies that the cmdlet deletes unneeded update files.



Required? false

Position? named

Default value none

Accept pipeline input? false

Accept wildcard characters? false



-CompressUpdates [<SwitchParameter>]

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



Required? false

Position? named

Default value none

Accept pipeline input? false

Accept wildcard characters? false



-DeclineExpiredUpdates [<SwitchParameter>]

Specifies that the cmdlet declines expired updates.



Required? false

Position? named

Default value none

Accept pipeline input? false

Accept wildcard characters? false



-DeclineSupersededUpdates [<SwitchParameter>]

Specifies that the cmdlet declines superseded updates.



Required? false

Position? named

Default value none

Accept pipeline input? false

Accept wildcard characters? false



-InformationAction [<System.Management.Automation.ActionPreference>]

Specifies how this cmdlet responds to an information event. The acceptable values for this parameter are:



-- Continue

-- Ignore

-- Inquire

-- SilentlyContinue

-- Stop

-- Suspend



Required? false

Position? named

Default value none

Accept pipeline input? false

Accept wildcard characters? false



-InformationVariable [<System.String>]

Specifies an information variable.



Required? false

Position? named

Default value none

Accept pipeline input? false

Accept wildcard characters? false



-UpdateServer [<IUpdateServer>]

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.



Required? false

Position? named

Default value none

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value false

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

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



Required? false

Position? named

Default value false

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

Microsoft.UpdateServices.Commands.IUpdateServer









OUTPUTS

None







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 consoso | 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.







RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=287832

Get-WsusServer