This project is read-only.

Unable to import module

Jun 6, 2013 at 6:02 PM
Edited Jun 6, 2013 at 6:36 PM
I have tried configuring mltiple machines with this and still get the same errors, this is running with admin privileges on Windows 7 SP1 x64:
PS C:\Windows\system32> Import-Module PoshWSUS
Import-Module : The following error occurred while loading the extended type data file:
Microsoft.PowerShell, C:\Users\NHDavies\Documents\WindowsPowerShell\Modules\PoshWSUS\TypeData\PoshWSUS.Types.ps1xml : File skipped because of the following validation exception: File C:\Users\NHDavies\Documents\WindowsPowerShell\Modules\PoshWSUS\TypeData\PoshWSUS.Types.ps1xml cannot be loaded. The file C:\Users\NHDavies\Documents\WindowsPowerShell\Modules\PoshWSUS\TypeData\PoshWSUS.Types.ps1xml is not digitally signed. The script will not execute on the system. Please see "get-help about_signing" for more details...
At line:1 char:14
+ Import-Module <<<<  PoshWSUS
    + CategoryInfo          : InvalidOperation: (:) [Import-Module], RuntimeException
    + FullyQualifiedErrorId : FormatXmlUpateException,Microsoft.PowerShell.Commands.ImportModuleCommand

PS C:\Windows\system32> Get-ExecutionPolicy
Help please
Jun 6, 2013 at 6:41 PM
Sorry, I have re-downloaded it and used 7-zip to extract. This seems to somehow have resolved it. I used the bult-in extraction tool for Windows which seems to break it.

Never mind, but hopefully will help someone in the future.
Mar 5, 2015 at 12:51 PM
When you download the ZIP file, right-click it, properties, and "Unblock" it. (Your browser) saves the files including an attribute that basically says it's from unsafe location (ie, the wild internet), and that's preserved when you unzip it with Windows internal tools. So always unblock a zip file before unzipping it - otherwise you'll have issues like this.

It's also why 7zip worked - it didn't preserve that attribute in the unzip operation.