PSWindowsUpdate module problems on Win 2022?

38 views
Skip to first unread message

Mike Leone

unread,
May 23, 2023, 1:01:15 PM5/23/23
to NTPowershell Mailing List
I set up a local repository, and installed the PSWindowsUpdate module in there, so I could install it on all my servers (we don't allow internet access to servers by default, so I needed a way to have it available locally).

Anyway, I configure the local repository, install the module from there, and all is well, I can access the cmdlets just fine. This is on Win 2012 R2, Win 2016, Win 2019.

Except on Win 2002, where it says it can't load the module. The repository installs fine (including nuget), but the module itself won't load, says the operation is not supported..

Is this happening to just me, or is this a known issue on Win 2022? The module version is 2.1.1.2.

PS C:\Windows\system32> import-module PSWindowsUpdate
import-module : Could not load file or assembly
'file://\\nt_san1\users\servadmin\Documents\WindowsPowerShell\Modules\PSWindowsUpdate\2.1.1.2\PSWindowsUpdate.dll' or
one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
At line:1 char:1
+ import-module PSWindowsUpdate
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Import-Module], FileLoadException
    + FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand

--

Mike. Leone, <mailto:tur...@mike-leone.com>

PGP Fingerprint: 0AA8 DC47 CB63 AE3F C739 6BF9 9AB4 1EF6 5AA5 BCDF
Photo Gallery: <http://www.flickr.com/photos/mikeleonephotos>

Michael B. Smith

unread,
May 23, 2023, 4:27:46 PM5/23/23
to ntpowe...@googlegroups.com

Check and see if it is blocked.

 

And, frankly, I didn’t know that Windows allowed you to load DLLs across a UNC path. Are you sure the module is installed locally?

 

Thanks.

 

Regards,

Michael B. Smith

Managing Consultant

Smith Consulting, LLC

--
You received this message because you are subscribed to the Google Groups "ntpowershell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ntpowershell...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/CAHBr%2B%2BjOVErPvz1h55VE69-H6P4nB96-cKeZgHU38LGcCSzt4Q%40mail.gmail.com.

Mike Leone

unread,
May 24, 2023, 9:57:23 AM5/24/23
to ntpowe...@googlegroups.com
On Tue, May 23, 2023 at 4:27 PM Michael B. Smith <mic...@smithcons.com> wrote:

Check and see if it is blocked.

 

And, frankly, I didn’t know that Windows allowed you to load DLLs across a UNC path. Are you sure the module is installed locally?


It is not installed locally (if you mean on the C: drive), no.  When I installed the module, I did

Install-Module -Name $ModuleName -Repository $LocalRepoName -Scope LocalUser

I did try copying the module to C:\Windows\System32\WindowsPowerShell\v1.0\Modules, and tried uninstall-module. But that didn't help, it still seems to want to find the files in the UNC path ..

PS C:\Windows\system32> import-module -name PSWindowsUpdate

import-module : Could not load file or assembly 'file://\\nt_san1\users\servadmin\Documents\WindowsPowerShell\Modules\PSWindowsUpdate\2.1.1.2\PSWindowsUpdate.dll'
or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
At line:1 char:1
+ import-module -name PSWindowsUpdate
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Import-Module], FileLoadException
    + FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand

I'm missing something basic, any clues on what?

Mike Leone

unread,
May 24, 2023, 11:43:09 AM5/24/23
to ntpowe...@googlegroups.com
AH! I see that, since folder redirection got turned on, the install defaulted to go there, rather than local. Once I turned off folder redirection (for this user), and cleaned up the redirected Powershell module in the redirected location, I was then able to properly install the module locally, like it used to.

So yes, it was a problem specific to me. And in this case, the install-module command installed it under the "Documents" folder, which in this case was redirected to a UNC path.

I haven't checked to see if I can make the install-module install to a specific, local location, rather than just defaulting to the user profile (which might be redirected).

So that answers that!

Thanks

Matt Stork

unread,
May 24, 2023, 1:55:58 PM5/24/23
to ntpowe...@googlegroups.com

“I did try copying the module to C:\Windows\System32\WindowsPowerShell\v1.0\Modules”

 

Don’t copy it there. That is the reserved for modules that ship with Windows. If you wish to install the module for all users, use “C:\Program Files\WindowsPowerShell\Modules”.

 

I’ve installed a few modules in the LocalUsers scope with document redirection turned on. I believe the technical term for that experience is “it sucked.”

-Matt

 

--

You received this message because you are subscribed to the Google Groups "ntpowershell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ntpowershell...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages