How to import splitpipeline module from a shared server?

1

My script uses the Powershell splitpipeline module, to bring parallel process and queues features.

The script and the module are stored on shared server, like \server\c$ , the idea is be able to run it from any computer.

Tried to put at begining of the script import-module \\server\c$\SplitPipeline but I recieve the error:

import-module : Could not load file or assembly 'file://\\server\c$\SplitPipeline\SplitPipeline.dll' or one of its dependencies.
Operation is not supported. (Exception from HRESULT: 0x80131515)
At D:\scripts\powershell\OstReport_BETA-PIPE.ps1:6 char:1
+ import-module \\server\c$\SplitPipeline
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Import-Module], FileLoadException
    + FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand

If I try to copy it from the srv to the pc with:

Copy-Item -Path \\server\c$\SplitPipeline -Destination C:\windows\system32\WindowsPowerShell\v1.0\Modules -recurse -force

I get a access denied

any ideas¿?

thanks

powershell
asked on Stack Overflow Jul 3, 2014 by pedaleo

1 Answer

3

The issue you're experiencing is that .NET assemblies can't be loaded from an untrusted UNC path, without special configuration. As you already discovered, the simplest solution is to copy the module to your local computer first.

To work around the "Access Denied" message, copy the module to your user directory, not the system-wide directory.

c:\users\<username>\Documents\WindowsPowerShell\Modules

You need to run PowerShell "as Administrator" in order to have permission to copy to the system folder, however it is generally recommended not to modify the default system directory. Instead, copy the module to your user folder (as above).

answered on Stack Overflow Jul 3, 2014 by Trevor Sullivan

User contributions licensed under CC BY-SA 3.0