PSWindowsUpdate module missing

I downloaded the module from PowershellGallery (stating “This module has no dependencies”) and stored it in a certain directory (for distribuition purposes - In the following example: c:\PSModules).
In my test I imported the module in an elevated ISE:

Import-Module c:\PSModules\PSWindowsUpdate 

works fine.

Get-WindowsUpdate  -NotCategory "Drivers"

works fine. As soon as I add -Download:

Get-WindowsUpdate -Download -NotCategory "Drivers"

ISE states:

Get-WindowsUpdate : PSWindowsUpdate module missing on destination machine
In Zeile:1 Zeichen:1
+ Get-WindowsUpdate -AcceptAll -Download -Install -NotCategory "Drivers ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Get-WindowsUpdate], Exception
    + FullyQualifiedErrorId : ModuleMissing,PSWindowsUpdate.GetWindowsUpdate

What’s wrong? Are there any depedencies which I am missing. If so: How can I find out which dependencies?

I’d start with that’s an odd way to install the module. I’d then make sure C:\PSModules is listed in your $env:psmodulepath variable.

$env:PSModulePath += ";C:\PSModules"

What would be your proposal for distributing PS-modules to a lot of clients/servers?

Why does it fail in finding the module dependant on the parameter of Get-WindowsUpdate?

Thanks - Michael

I think this is correctly explained on about PSModulePath - PowerShell | Microsoft Learn
You can switch to version 5.1, as you are probably using this version on those many computers.


I am already with PS 5.1.

I understand Import-Module that I may import a module from any location not being forced to use PSModulePath.


You understood it correctly. But what is the advantage of placing your module to C:\PSModules? And do you regularily install software to other folders than program files or program files (x86)? Or do you force installations to place shared DLLs to folders in the root of your C: drive instead of the folder system32? :wink:

In general I agree. My “problem” with distribution is:

  • I want to avoid time consuming Install-Module
  • I learned that PSModulePath might be different for each and every customers for whatever reasons
  • My example tells me that I do not have a general problem with finding the module but with the parameter -Download.


How big is this module? Do you have to deploy it more than once per computer? If you have a software deployment solution in place it should take only seconds to copy the module folder to the proper directory. And in your script you use the #requires statement to prevent the script from running if the module is not available.

If you’re talking about the user specific module paths you’re right. But there are computer specific module paths as well. And these are all the same for all users. :man_shrugging:t3: The default for Windows PowerShell would be C:\Program Files\WindowsPowerShell\Modules.

I don’t have any experience with this particular module. But if I had to use it I’d try to keep everything as generic as possible to avoid any possible problem.

Thanks - I’ll consider - Michael