Select Page

Today a new PowerShell funny arose while using a machine I did not build or install.

Using PowerGUI (other PowerShell script environments are available!) when attempting to import the servermanager module, I was receiving the following error:

PS C:UsersAdministrator> Import-Module servermanager
Import-Module : The specified module ‘servermanager’ was not loaded because no valid module file was found in any module directory.
At line:1 char:14
+ Import-Module <<<< servermanager
+ CategoryInfo : ResourceUnavailable: (servermanager:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Mighty strange.

Opening a regular PoSh session, I was able to import the module as expected, and a quick browse to the module path of PoSh showed the servermanager folder and manifest to be present and correct.

What to do?

Turns out that the previous user of the machine (a Windows Server 2008R2 box, for reference) had been using the x86 build of the PowerGUI script editor, which had then nailed itself to the Start menu ready to be clicked by the unsuspecting Seb.

The x86 build of PowerGUI was trying to load the (only version present) 64bit servermanager module which caused this issue to manifest.

Switching to the 64bit (“proper”) version of PowerGUI and lo and behold, the module imports without drama. Needless to say, the x86 version was unpinned and the 64bit pinned!

10 minutes of head scratching wasted, but a solution found.

more to follow…