none
Help with PSWindowsupdate PS script RRS feed

  • Question

  • I am in the process of trying to uninstall Windows updates on my remote windows 10 machines.

    I am attempting to use the Get-WUUninstall, but get prompted to answer Y or N.

    Using the -force switch does not appear to work.

    PS C:\WINDOWS\system32> Get-WUUninstall KB4465065

    Confirm
    Are you sure you want to perform this action?
    Performing the operation "Uninstall update KB4465065" on target "pchostname".
    [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):


    PS C:\WINDOWS\system32> Get-WUUninstall KB4465065 -force
    Get-WUUninstall : A parameter cannot be found that matches parameter name 'force'.
    At line:1 char:27
    + Get-WUUninstall KB4465065 -force
    +                           ~~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Get-WUUninstall], ParameterBindingException
        + FullyQualifiedErrorId : NamedParameterNotFound,Get-WUUninstall

    Is there a way I can force the uninstall? 

    Overall, I need to be able to uninstall a KB if needed and immediately block it without any user interaction. This seems to be a major challenge with Windows 10

    Please advise.

    Thanks


    • Edited by vs2017sv Thursday, June 20, 2019 11:20 PM
    Thursday, June 20, 2019 11:16 PM

All replies

  • Please format your code as code using the code posting tool provided on the icon bar of the post editor (second to last icon). Thanks.

    For issues with or questions about gallery scripts or gallery modules you should contact the author - PSWindowsUpdate 2.1.0.1.


    Live long and prosper!

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


    • Edited by BOfH_666 Friday, June 21, 2019 12:08 AM
    Friday, June 21, 2019 12:08 AM
  • The module PsWindowsUpdate does not have that command.

    Do this:

    get-command -Module  PSWindowsUpdate -Name get*

    Where did you get this command?  I cannot find it snywhere on the net.


    \_(ツ)_/

    Friday, June 21, 2019 12:14 AM
  • I have contacted the author, but have yet to hear back. 
    Friday, June 21, 2019 12:18 AM
  • PS C:\WINDOWS\system32> get-command -Module  PSWindowsUpdate -Name get*

    CommandType     Name                                               Version    Source
    -----------     ----                                               -------    ------
    Alias           Get-WindowsUpdate                                  1.5.2.6    PSWindowsUpdate
    Function        Get-WUHistory                                      1.5.2.6    PSWindowsUpdate
    Function        Get-WUInstall                                      1.5.2.6    PSWindowsUpdate
    Function        Get-WUInstallerStatus                              1.5.2.6    PSWindowsUpdate
    Function        Get-WUList                                         1.5.2.6    PSWindowsUpdate
    Function        Get-WURebootStatus                                 1.5.2.6    PSWindowsUpdate
    Function        Get-WUServiceManager                               1.5.2.6    PSWindowsUpdate
    Function        Get-WUUninstall                                    1.5.2.6    PSWindowsUpdate

    https://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc

    I was able to get the command to run by adding the "-confirm:$false", but I now get prompted with a yes no, would you like to uninstall.

    PS C:\WINDOWS\system32> Get-WUUninstall KB4465065 -confirm:$false


    Friday, June 21, 2019 12:22 AM
  • The command was removed from the module for some reason -  likely due to a violation of the naming rule.  "Get" cannot be used with an action that changes the system.

    To remove a KB using the module use "Remove-WindowsUpdate".  Be sure you have the latest module.

    Update-Module PSWindowsupdate


    \_(ツ)_/


    • Edited by jrv Friday, June 21, 2019 12:25 AM
    Friday, June 21, 2019 12:24 AM
  • PS C:\WINDOWS\system32> get-command -Module  PSWindowsUpdate -Name get*

    CommandType     Name                                               Version    Source
    -----------     ----                                               -------    ------
    Alias           Get-WindowsUpdate                                  1.5.2.6    PSWindowsUpdate
    Function        Get-WUHistory                                      1.5.2.6    PSWindowsUpdate
    Function        Get-WUInstall                                      1.5.2.6    PSWindowsUpdate
    Function        Get-WUInstallerStatus                              1.5.2.6    PSWindowsUpdate
    Function        Get-WUList                                         1.5.2.6    PSWindowsUpdate
    Function        Get-WURebootStatus                                 1.5.2.6    PSWindowsUpdate
    Function        Get-WUServiceManager                               1.5.2.6    PSWindowsUpdate
    Function        Get-WUUninstall                                    1.5.2.6    PSWindowsUpdate

    https://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc

    I was able to get the command to run by adding the "-confirm:$false", but I now get prompted with a yes no, would you like to uninstall.

    PS C:\WINDOWS\system32> Get-WUUninstall KB4465065 -confirm:$false


    Delete this module folder and use:

    Install-Module PsWindowsUpdate

    This will install the latest version from PowerShellGet.  I wish someone would remove these old modules from the script gallery and replace with instructions for PowerShellGet.


    \_(ツ)_/

    Friday, June 21, 2019 12:28 AM
  • Looks like it wants me to install NuGet

    PS C:\WINDOWS\system32> Install-Module PsWindowsUpdate
    NuGet provider is required to continue
    PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with
    NuGet-based repositories. The NuGet provider must be available in 'C:\Program
    Files\PackageManagement\ProviderAssemblies' or
    'C:\Users\admin\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the
     NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201
    -Force'. Do you want PowerShellGet to install and import the NuGet provider now?
    [Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):

    Friday, June 21, 2019 12:37 AM
  • Do you know where this new PSWindowupdate gets installed to?

    Friday, June 21, 2019 12:42 AM
  • You need to upgrade to WMF 5.1.  It will install all of the necessary components.


    \_(ツ)_/

    Friday, June 21, 2019 12:59 AM
  • Do you know where this new PSWindowupdate gets installed to?

    Yes.  It gets installed to the modules folder: "C:\Program Files\WindowsPowerShell\Modules"


    \_(ツ)_/

    Friday, June 21, 2019 1:01 AM
  • Thank you. Just took a bit to download.

    So I am running the commands now and getting the following..

    PS C:\WINDOWS\system32> Get-Command -module PSWindowsUpdate
    CommandType     Name                                               Version    Source
    -----------     ----                                               -------    ------
    Alias           Clear-WUJob                                        2.1.1.2    PSWindowsUpdate
    Alias           Download-WindowsUpdate                             2.1.1.2    PSWindowsUpdate
    Alias           Get-WUInstall                                      2.1.1.2    PSWindowsUpdate
    Alias           Get-WUList                                         2.1.1.2    PSWindowsUpdate
    Alias           Hide-WindowsUpdate                                 2.1.1.2    PSWindowsUpdate
    Alias           Install-WindowsUpdate                              2.1.1.2    PSWindowsUpdate
    Alias           Show-WindowsUpdate                                 2.1.1.2    PSWindowsUpdate
    Alias           UnHide-WindowsUpdate                               2.1.1.2    PSWindowsUpdate
    Alias           Uninstall-WindowsUpdate                            2.1.1.2    PSWindowsUpdate
    Cmdlet          Add-WUServiceManager                               2.1.1.2    PSWindowsUpdate
    Cmdlet          Enable-WURemoting                                  2.1.1.2    PSWindowsUpdate
    Cmdlet          Get-WindowsUpdate                                  2.1.1.2    PSWindowsUpdate
    Cmdlet          Get-WUApiVersion                                   2.1.1.2    PSWindowsUpdate
    Cmdlet          Get-WUHistory                                      2.1.1.2    PSWindowsUpdate
    Cmdlet          Get-WUInstallerStatus                              2.1.1.2    PSWindowsUpdate
    Cmdlet          Get-WUJob                                          2.1.1.2    PSWindowsUpdate
    Cmdlet          Get-WULastResults                                  2.1.1.2    PSWindowsUpdate
    Cmdlet          Get-WURebootStatus                                 2.1.1.2    PSWindowsUpdate
    Cmdlet          Get-WUServiceManager                               2.1.1.2    PSWindowsUpdate
    Cmdlet          Get-WUSettings                                     2.1.1.2    PSWindowsUpdate
    Cmdlet          Invoke-WUJob                                       2.1.1.2    PSWindowsUpdate
    Cmdlet          Remove-WindowsUpdate                               2.1.1.2    PSWindowsUpdate
    Cmdlet          Remove-WUServiceManager                            2.1.1.2    PSWindowsUpdate
    Cmdlet          Set-PSWUSettings                                   2.1.1.2    PSWindowsUpdate
    Cmdlet          Set-WUSettings                                     2.1.1.2    PSWindowsUpdate
    Cmdlet          Update-WUModule                                    2.1.1.2    PSWindowsUpdate


    PS C:\WINDOWS\system32> Uninstall-WindowsUpdate KB4503864
    Remove-WindowsUpdate : A positional parameter cannot be found that accepts argument 'KB4503864'.
    At line:1 char:1
    + Uninstall-WindowsUpdate KB4503864
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Remove-WindowsUpdate], ParameterBindingException
        + FullyQualifiedErrorId : PositionalParameterNotFound,PSWindowsUpdate.Rem
    oveWindowsUpdate

    PS C:\WINDOWS\system32> Remove-WindowsUpdate KB4503864
    Remove-WindowsUpdate : A positional parameter cannot be found that accepts argument 'KB4503864'.
    At line:1 char:1
    + Remove-WindowsUpdate KB4503864
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Remove-WindowsUpdate], ParameterBindingException
        + FullyQualifiedErrorId : PositionalParameterNotFound,PSWindowsUpdate.RemoveWindowsUpdate

    Friday, June 21, 2019 1:18 AM
  • Thank you. Just took a bit to download.

    So I am running the commands now and getting the following..

    PS C:\WINDOWS\system32> Get-Command -module PSWindowsUpdate
    CommandType     Name                                               Version    Source
    -----------     ----                                               -------    ------
    Alias           Clear-WUJob                                        2.1.1.2    PSWindowsUpdate
    Alias           Download-WindowsUpdate                             2.1.1.2    PSWindowsUpdate
    Alias           Get-WUInstall                                      2.1.1.2    PSWindowsUpdate
    Alias           Get-WUList                                         2.1.1.2    PSWindowsUpdate
    Alias           Hide-WindowsUpdate                                 2.1.1.2    PSWindowsUpdate
    Alias           Install-WindowsUpdate                              2.1.1.2    PSWindowsUpdate
    Alias           Show-WindowsUpdate                                 2.1.1.2    PSWindowsUpdate
    Alias           UnHide-WindowsUpdate                               2.1.1.2    PSWindowsUpdate
    Alias           Uninstall-WindowsUpdate                            2.1.1.2    PSWindowsUpdate
    Cmdlet          Add-WUServiceManager                               2.1.1.2    PSWindowsUpdate
    Cmdlet          Enable-WURemoting                                  2.1.1.2    PSWindowsUpdate
    Cmdlet          Get-WindowsUpdate                                  2.1.1.2    PSWindowsUpdate
    Cmdlet          Get-WUApiVersion                                   2.1.1.2    PSWindowsUpdate
    Cmdlet          Get-WUHistory                                      2.1.1.2    PSWindowsUpdate
    Cmdlet          Get-WUInstallerStatus                              2.1.1.2    PSWindowsUpdate
    Cmdlet          Get-WUJob                                          2.1.1.2    PSWindowsUpdate
    Cmdlet          Get-WULastResults                                  2.1.1.2    PSWindowsUpdate
    Cmdlet          Get-WURebootStatus                                 2.1.1.2    PSWindowsUpdate
    Cmdlet          Get-WUServiceManager                               2.1.1.2    PSWindowsUpdate
    Cmdlet          Get-WUSettings                                     2.1.1.2    PSWindowsUpdate
    Cmdlet          Invoke-WUJob                                       2.1.1.2    PSWindowsUpdate
    Cmdlet          Remove-WindowsUpdate                               2.1.1.2    PSWindowsUpdate
    Cmdlet          Remove-WUServiceManager                            2.1.1.2    PSWindowsUpdate
    Cmdlet          Set-PSWUSettings                                   2.1.1.2    PSWindowsUpdate
    Cmdlet          Set-WUSettings                                     2.1.1.2    PSWindowsUpdate
    Cmdlet          Update-WUModule                                    2.1.1.2    PSWindowsUpdate


    PS C:\WINDOWS\system32> Uninstall-WindowsUpdate KB4503864
    Remove-WindowsUpdate : A positional parameter cannot be found that accepts argument 'KB4503864'.
    At line:1 char:1
    + Uninstall-WindowsUpdate KB4503864
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Remove-WindowsUpdate], ParameterBindingException
        + FullyQualifiedErrorId : PositionalParameterNotFound,PSWindowsUpdate.Rem
    oveWindowsUpdate

    PS C:\WINDOWS\system32> Remove-WindowsUpdate KB4503864
    Remove-WindowsUpdate : A positional parameter cannot be found that accepts argument 'KB4503864'.
    At line:1 char:1
    + Remove-WindowsUpdate KB4503864
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Remove-WindowsUpdate], ParameterBindingException
        + FullyQualifiedErrorId : PositionalParameterNotFound,PSWindowsUpdate.RemoveWindowsUpdate

    You need to first learn PowerShell and then these things will make sense.  Also use help to learn how to use CmdLets.  In modern advanced technology guessing never works out well.

    help Uninstall-WindowsUpdate  -online

    Uninstall-WindowsUpdate -KBArticleID KB4503864

    One of the first things you will learn if you decide to learn PowerShell is how to use help.


    \_(ツ)_/

    Friday, June 21, 2019 1:57 AM
  • I have tried a ton of commands and can't seem to get any update to uninstall via this method

    Odd that MS makes it so complicated to remove a update. 


    Stop acting like a helpless 12 year old and take the time to learn PowerShell.  All of your issues are due to lack of basic training. 

    \_(ツ)_/

    Friday, June 21, 2019 1:58 AM
  • Today is the first day I have had to use powershell.

    That help command is exactly what I needed.

    I was also able to remove updates via DISM.

    Thank for the assistance.


    • Edited by vs2017sv Friday, June 21, 2019 2:41 AM
    Friday, June 21, 2019 2:33 AM