none
Specified method is not supported error message when trying to run powershell script RRS feed

  • Question

  • Hello,

    I found a really nice script (short and simple) that assists with cleaning up WSUS

    (https://gallery.technet.microsoft.com/scriptcenter/decline-superseded-and-922d6d82)

    However, every time I try to run it I get the following error message:

    Connecting to WSUS Server Localhost and getting list of updates
    .\Decline-Updates.ps1 : Specified method is not supported.
        + CategoryInfo          : NotImplemented: (:) [], PSNotSupportedException
        + FullyQualifiedErrorId : NotSupported

    Any idea what may be causing this issue?  The server is running Windows server 2012 and my powershell version is 5, build 10586.  Any help you can provide can be greatly appreciated.

    • Moved by Bill_Stewart Friday, July 27, 2018 8:14 PM This is not support forum for gallery scripts
    Friday, May 4, 2018 11:36 AM

All replies

  • There is a Q&A Section on the site for this script. Please contact the author if you need help or if you found a bug.

    Please read this first: This forum is for scripting questions rather than script requests.

    Also find scripts here: PowerShell Gallery or here: TechNet Gallery - resources for IT professionals.

    Learn PowerShell: Microsoft Virtual Academy - Getting Started with Microsoft PowerShell.

    Script requests: Microsoft Technet Script Center - Requests.


    Best regards,

    (79,108,97,102|%{[char]$_})-join''



    • Edited by BOfH-666 Friday, May 4, 2018 11:48 AM
    Friday, May 4, 2018 11:46 AM
  • You can try this, in Cleanup section Replace "$false" by "$true" for the options what you want.

    $LogCatch = "C:\temp\LogCatch.txt"
    
    #region - Connection to WSUS
    
    $WsusServer = "Name of Your Server"
    $WsusPort = "8530"
    
    #region - Opening connection to server 
    Try {
        [void][reflection.assembly]::loadwithpartialname("microsoft.updateservices.administration")
        $Wsus = [microsoft.updateservices.administration.adminproxy]::getupdateserver($WsusServer,$false,$WsusPort)
        $Wsus.Name
        $Log = $Wsus.Name
        }
    Catch {
        Write-Warning "$($WsusServer)<$($WsusPort)>: $($_)" | Add-Content -Path $LogCatch
        $Connection = "Failed"
        Write-Output "$Connection" | Add-Content $LogCatch
        }
    If ($Log -eq $null){
        Try {
            $WsusPort2 = "80"
            [void][reflection.assembly]::loadwithpartialname("microsoft.updateservices.administration")
            $Wsus = [microsoft.updateservices.administration.adminproxy]::getupdateserver($WsusServer,$false,$WsusPort2)
            $Wsus.Name
            }
        Catch {
            Write-Warning "$($WsusServer)<$($WsusPort2)>: $($_)" | Add-Content -Path $LogCatch
            }
        }
    #endregion - Opening connection to server
    #endregion - Connection to WSUS
    
    #region - Cleanup
    
    # Decline updates that have not been approved for 30 days or more, are not currently needed by any clients, and are superseded by an aproved update. 
    [Boolean]$supersededUpdates = $false 
    # Decline updates that aren't approved and have been expired my Microsoft. 
    [Boolean]$expiredUpdates = $false 
    # Delete updates that are expired and have not been approved for 30 days or more. 
    [Boolean]$obsoleteUpdates = $false 
    # Delete older update revisions that have not been approved for 30 days or more. 
    [Boolean]$compressUpdates = $false 
    # Delete computers that have not contacted the server in 30 days or more. 
    [Boolean]$obsoleteComputers = $false 
    # Delete update files that aren't needed by updates or downstream servers. 
    [Boolean]$unneededContentFiles = $false 
    
    $CleanupScope = New-Object Microsoft.UpdateServices.Administration.CleanupScope($supersededUpdates,$expiredUpdates,$obsoleteUpdates,$compressUpdates,$obsoleteComputers,$unneededContentFiles) 
    
    ($Wsus.GetCleanupManager()).PerformCleanup($CleanupScope)
    
    #endregion - Cleanup


    Tuesday, May 15, 2018 9:14 AM