PoshWSUS icon indicating copy to clipboard operation
PoshWSUS copied to clipboard

Import-Module not working

Open Sacknuss opened this issue 8 years ago • 2 comments

Hi,

I get an error if I try to import your module:

Import-Module : The assembly 'Microsoft.UpdateServices.Administration' was not loaded because no assembly with that name was found.

I figured that this entry is the issue:

# Assemblies that must be loaded prior to importing this module RequiredAssemblies = @("Microsoft.UpdateServices.Administration")

When I remove this it works properly. If I understand correctly - Your module (.psm1) checks if the wsus role is installed on the server. If so it will load the assemblies. If not it will load the libraries that come with your module (libraries\x64 or x86).

So no need to put anything into "RequiredAssemblies", right? Not sure if I'm correct though.

Cheers Psyduck

Sacknuss avatar Aug 22 '16 14:08 Sacknuss

I receive the same error when I attempt to Import-Module on a machine which does not have the UpdateServices WindowsFeature components already installed.

Psyduck is correct, if I comment out Line 56 in PoshWSUS.psd1 then I can import and use the PoshWSUS module successfully.

This is tested with 2.3.1.5

Thank you for the share Psyduck, saved me more headscratching :-)

jpritchard avatar Oct 25 '16 22:10 jpritchard

Importing-Module of version 2.3.1.2 causes "Commands" plugin in ISE (Win2012R2) to fail... Any ideas?

" Failed to refresh. Message: 'Unable to find type [Microsoft.UpdateServices.Internal.BaseApi.Update].' "

mezinster avatar Jul 10 '17 11:07 mezinster