WSUS via PowerShell - Find update file location RRS feed

  • Question

  • I am writing a script to cleanup wsus more in depth.

    I need the command to find the update file location on the WSUS server

    From my research I belleive it should be something like Update.FileUri however I cannot get this to return any results

    Code so far

    $wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer();

    $approveState = 'Microsoft.UpdateServices.Administration.ApprovedStates' -as [type]

    $updateScope = New-Object Microsoft.UpdateServices.Administration.UpdateScope -Property @{
        ApprovedStates = $approveState::Declined
    $Declined = $wsus.GetUpdates($updateScope)| Where {$_.IsSuperseded -eq $True - or $_.PublicationState -eq "Expired"}
    #Write-Host $Declined.count
    If ($Declined.count -GT 0) {
        $Counter = 0
        $Declined | ForEach-Object {
        $Counter = $Counter + 1
        Write-Host $Counter of $Declined.count $_.Title $_.FileUri
    Write-Host No updates Fount to Remove

    Saturday, May 16, 2015 1:44 AM

All replies

  • Hi Robert,

    We can use IUpdate.GetInstallableItems method to get the installable items of the specific update.

    Then we can use "select -Expand Files" to get the file uri of the update.

    I tested it in my lab, it works prolerly. Here is the screenshot of my lab:

    Here is the technical reference of IUpdate.GetInstallableItems method.


    Best Regards.

    Steven Lee Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Monday, May 18, 2015 8:33 AM
  • Thanks for the reply Steven, this is certainly what I am after except that I need it to pass just the fileuri to a collection. also is it possible to see it referenced as the local drive as is seen in the WSUS console Update, File Information.

    as a second question can we find the language.



    Monday, May 18, 2015 9:17 PM