1

Closed

2.2.1 - Command only works after manual load of Microsoft.UpdateServices.Administration

description

Hi,

I downloaded 2.2.1 to my Windows Server 2008 R2 with installed WSUS.
I've imported the module
import-module .\PoshWSUS.psm1
but
Connect-PoshWSUSServer .
didn't work.

After some debugging I found that if I load this assembly manually
reflection.assembly::LoadWithPartialName("Microsoft.UpdateServices.Administration")
then everything works.

Could you please autoload this or document it properly?
Maybe check on module-import and through usefull error message?

greetings
Carsten
Closed Feb 18, 2015 at 3:24 PM by boeprox

comments

boeprox wrote Feb 25, 2014 at 2:40 PM

This is automatically loaded when the module is imported via the module manifest (.psd1 file).

It looks like you are importing the module incorrectly by importing the psm1 file which does not load the required assemblies to avoid conflict with the manifest. The best practice with modules is to save them to the Modules folder which you can find by doing the following:
$env:PSModulePath -split ';'
The path that is not under the System32 folder is where it should be saved to. From there you can view the modules available via the following command:
Get-Module -ListAvailable
You should see PoshWSUS listed which you can import just by doing this:
Import-Module PoshWSUS