PSWindowsUpdate Module Fails using old version

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: (:slight_smile: [], RuntimeException
  • FullyQualifiedErrorId : ComparisonFailure

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

 

 

 

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?

 

Thank you

 

Tom

 

 

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.

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>

 

Any ideas

 

 

 

 

 

 

 

I am still struggling with this

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

 

 

Thank you