# PSWindowsUpdate Module Fails using old version

**URL:** <https://forums.powershell.org/t/pswindowsupdate-module-fails-using-old-version/12570>\
**Category:** PowerShell Help\
**Created:** [May 16, 2019, 4:10pm UTC](https://forums.powershell.org/t/pswindowsupdate-module-fails-using-old-version/12570 "2019-05-16T16:10:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![trgrassijr](https://avatars.discourse-cdn.com/v4/letter/t/fbc32d/32.png) [@trgrassijr](https://forums.powershell.org/u/trgrassijr)\
**Post date:** [May 16, 2019, 4:10pm UTC](https://forums.powershell.org/t/pswindowsupdate-module-fails-using-old-version/12570/1 "2019-05-16T16:10:11Z")

</div>

this was before with old module installed

PS C:\temp\pswindowsupdate\PSWindowsUpdate\> get-module

ModuleType Version Name ExportedCommands

* * *

Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Con…  
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object…}  
Binary 1.0.0.1 PackageManagement {Find-Package, Find-PackageProvider, Get-Package, Get-Pack…  
Script 1.0.0.1 PowerShellGet {Find-Command, Find-DscResource, Find-Module, Find-RoleCap…  
Script 1.2 PSReadline {Get-PSReadlineKeyHandler, Get-PSReadlineOption, Remove-PS…  
Manifest 1.5.2.2 PSWindowsUpdate {Add-WUOfflineSync, Add-WUServiceManager, Get-WUHistory, G…  
Binary 2.1.1.2 PSWindowsUpdate {Add-WUServiceManager, Enable-WURemoting, Get-WindowsUpdat…

I did a remove-module -name pswindowsupdate

Then install-module PSWindowsUpdate

PS C:\temp\pswindowsupdate\PSWindowsUpdate\> get-module

ModuleType Version Name ExportedCommands

* * *

Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Con…  
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object…}  
Binary 1.0.0.1 PackageManagement {Find-Package, Find-PackageProvider, Get-Package, Get-Pack…  
Script 1.0.0.1 PowerShellGet {Find-Command, Find-DscResource, Find-Module, Find-RoleCap…  
Script 1.2 PSReadline {Get-PSReadlineKeyHandler, Get-PSReadlineOption, Remove-PS…  
Manifest 1.5.2.2 PSWindowsUpdate {Add-WUOfflineSync, Add-WUServiceManager, Get-WUHistory, G…

PS C:\temp\pswindowsupdate\PSWindowsUpdate\> Invoke-WUInstall -ComputerName TGCS011 -Script {ipmo PSWindowsUpdate; Get-WU  
Install -AcceptAll | Out-File C:PSWindowsUpdate.log } -Confirm:$false –Verbose  
VERBOSE: Populating RepositorySourceLocation property for module PSWindowsUpdate.  
VERBOSE: Loading module from path ‘C:\Program  
Files\WindowsPowerShell\Modules\PSWindowsUpdate\2.1.1.2\PSWindowsUpdate.psm1’.  
VERBOSE: Loading module from path ‘C:\Program  
Files\WindowsPowerShell\Modules\PSWindowsUpdate\2.1.1.2\PSWindowsUpdate.dll’.  
VERBOSE: Populating RepositorySourceLocation property for module PSWindowsUpdate.  
VERBOSE: Loading module from path  
‘C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate\1.5.2.2\PSWindowsUpdate.psm1’.  
VERBOSE: Create schedule service object  
VERBOSE: Performing the operation “Invoke WUInstall” on target “TGCS011”.  
VERBOSE: Check PSWindowsUpdate module on TGCS011  
Could not compare “1.5.2.2” to “2.1.1.2 1.5.2.2”. Error: “Cannot convert the “System.Object” value of type  
“System.Object” to type “System.Version”.”  
At C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate\1.5.2.2\Invoke-WUInstall.ps1:103 char:9

- … if($ModuleTest -eq $null -or $ModuleTest.Version -lt $PSWUMo …
- 

```
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

```

- CategoryInfo : InvalidOperation: (🙂 , RuntimeException
- FullyQualifiedErrorId : ComparisonFailure

VERBOSE: Connect to scheduler and register task on TGCS011.  
VERBOSE: Invoke-WUInstall complete.  
PS C:\temp\pswindowsupdate\PSWindowsUpdate\>

&nbsp;

&nbsp;

&nbsp;

It fails on the Could not compare “1.5.2.2” to “2.1.1.2 1.5.2.2”. Error: “Cannot convert the “System.Object” value of type  
“System.Object” to type “System.Version”.”

I do not need to install this module on my remote computers correct?

Any ideas?

&nbsp;

Thank you

&nbsp;

Tom

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![postanote](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@postanote](https://forums.powershell.org/u/postanote)\
**Post date:** [May 16, 2019, 5:28pm UTC](https://forums.powershell.org/t/pswindowsupdate-module-fails-using-old-version/12570/2 "2019-05-16T17:28:01Z")

</div>

Modules and functions have to exist on the computer where scripts are executed, on loaded on the session they are to be executed on.

When you did the remove, did you actually hard validate that all the bits were removed?  
There is a -force parameter that can be used on installs and uninstalls.

---

<div class="post-metadata">

**Author:** ![trgrassijr](https://avatars.discourse-cdn.com/v4/letter/t/fbc32d/32.png) [@trgrassijr](https://forums.powershell.org/u/trgrassijr)\
**Post date:** [May 16, 2019, 8:32pm UTC](https://forums.powershell.org/t/pswindowsupdate-module-fails-using-old-version/12570/3 "2019-05-16T20:32:18Z")

</div>

Got it to sorta work

I had to delete the folders from c:\program files\windowspowershell\modulespswindoesupdate I removed them all and ran this

Install-Module -Name PSWindowsUpdate -RequiredVersion 2.0.0.4

Have to do that on all machines

I tried these two

PS C:\temp\> Invoke-WUInstall -ComputerName TGCS005-n1 -Script {ipmo PSWindowsUpdate; Get-WUInstall -AcceptAll | Out-File C:PSWindowsUpdate.log } -Confirm:$false –Verbose  
VERBOSE: Populating RepositorySourceLocation property for module PSWindowsUpdate.  
VERBOSE: Loading module from path ‘C:\Program Files\WindowsPowerShell\Modules\PSWindowsUpdate\2.0.0.4\PSWindowsUpdate.psm1’.  
VERBOSE: Loading module from path ‘C:\Program Files\WindowsPowerShell\Modules\PSWindowsUpdate\2.0.0.4\PSWindowsUpdate.dll’.  
VERBOSE: Create schedule service object  
VERBOSE: Performing the operation “Invoke WUInstall” on target “TGCS005-n1”.  
VERBOSE: Check PSWindowsUpdate module on TGCS005-n1  
VERBOSE: Populating RepositorySourceLocation property for module PSWindowsUpdate.  
VERBOSE: Loading module from path ‘C:\Program Files\WindowsPowerShell\Modules\PSWindowsUpdate\2.0.0.4\PSWindowsUpdate.psm1’.  
VERBOSE: Loading module from path ‘C:\Program Files\WindowsPowerShell\Modules\PSWindowsUpdate\2.0.0.4\PSWindowsUpdate.dll’.  
VERBOSE: Populating RepositorySourceLocation property for module PSWindowsUpdate.  
VERBOSE: Loading module from path ‘C:\Program Files\WindowsPowerShell\Modules\PSWindowsUpdate\2.0.0.4\PSWindowsUpdate.psm1’.  
VERBOSE: Loading module from path ‘C:\Program Files\WindowsPowerShell\Modules\PSWindowsUpdate\2.0.0.4\PSWindowsUpdate.dll’.  
VERBOSE: Version specified in ModuleVersion key is equal to version folder name.  
VERBOSE: The latest version of PSWindowsUpdate module is 2.0.0.4  
VERBOSE: PSWindowsUpdate module version on machine TGCS005-n1 is (2.0.0.4 1.6.0.3) and it’s older then downloaded (2.0.0.4). Updating…  
WARNING: Can’t updated PSWindowsUpdate module on machine TGCS005-n1  
VERBOSE: Connect to scheduler and register task on TGCS005-n1.  
VERBOSE: Invoke-WUInstall complete.  
PS C:\temp\> Invoke-WUInstall -ComputerName TGCS003-2012r2 -Script {ipmo PSWindowsUpdate; Get-WUInstall -AcceptAll | Out-File C:PSWindowsUpdate.log } -Confirm:$false –Verbose  
VERBOSE: Populating RepositorySourceLocation property for module PSWindowsUpdate.  
VERBOSE: Loading module from path ‘C:\Program Files\WindowsPowerShell\Modules\PSWindowsUpdate\2.0.0.4\PSWindowsUpdate.psm1’.  
VERBOSE: Loading module from path ‘C:\Program Files\WindowsPowerShell\Modules\PSWindowsUpdate\2.0.0.4\PSWindowsUpdate.dll’.  
VERBOSE: Create schedule service object  
VERBOSE: Performing the operation “Invoke WUInstall” on target “TGCS003-2012r2”.  
VERBOSE: Check PSWindowsUpdate module on TGCS003-2012r2  
VERBOSE: Populating RepositorySourceLocation property for module PSWindowsUpdate.  
VERBOSE: Loading module from path ‘C:\Program Files\WindowsPowerShell\Modules\PSWindowsUpdate\2.0.0.4\PSWindowsUpdate.psm1’.  
VERBOSE: Loading module from path ‘C:\Program Files\WindowsPowerShell\Modules\PSWindowsUpdate\2.0.0.4\PSWindowsUpdate.dll’.  
VERBOSE: Populating RepositorySourceLocation property for module PSWindowsUpdate.  
VERBOSE: Loading module from path ‘C:\Program Files\WindowsPowerShell\Modules\PSWindowsUpdate\2.0.0.4\PSWindowsUpdate.psm1’.  
VERBOSE: Loading module from path ‘C:\Program Files\WindowsPowerShell\Modules\PSWindowsUpdate\2.0.0.4\PSWindowsUpdate.dll’.  
VERBOSE: Version specified in ModuleVersion key is equal to version folder name.  
VERBOSE: The latest version of PSWindowsUpdate module is 2.0.0.4  
VERBOSE: PSWindowsUpdate module version on machine TGCS003-2012r2 is (2.0.0.4 1.6.0.3) and it’s older then downloaded (2.0.0.4). Updating…  
WARNING: Can’t updated PSWindowsUpdate module on machine TGCS003-2012r2  
VERBOSE: Connect to scheduler and register task on TGCS003-2012r2.  
VERBOSE: Invoke-WUInstall complete.  
PS C:\temp\>

&nbsp;

Any ideas

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![trgrassijr](https://avatars.discourse-cdn.com/v4/letter/t/fbc32d/32.png) [@trgrassijr](https://forums.powershell.org/u/trgrassijr)\
**Post date:** [May 23, 2019, 6:17am UTC](https://forums.powershell.org/t/pswindowsupdate-module-fails-using-old-version/12570/4 "2019-05-23T06:17:39Z")

</div>

I am still struggling with this

Need a way to start windows updates remotely using invoke-command

&nbsp;

&nbsp;

Thank you

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:32pm UTC](https://forums.powershell.org/t/pswindowsupdate-module-fails-using-old-version/12570/5 "2024-05-16T20:32:44Z")

</div>

Closed on May 16, 2024, 8:32pm UTC


