Feb 3, 2010 at 12:52 PM

Anyone able to use this predefined function?

If I use "Import-PowerModule test.ps1" I get the following error:

"Exception calling "ImportPowerModule" with "2" argument(s): "Value does not fall within the expected range."
At line:5 char:28 + $this.ImportPowerModule <<<< ($name, $($noCache -ne $null))"

The Absolute URL in the CA is set correct. The script test.ps1 is valid. I´ve access to the script library.

 Any idea? Any "special" syntax necessary?

Feb 18, 2010 at 10:11 AM


I've got the same problems as markusk71. What can I do?

I really want to use Power WebPart, but our Sharepoint admin
will only give green light in combination with the "ImportPowerModul"

Best regards


Feb 19, 2010 at 3:18 PM

The only thing I've been able to come up with is having a workflow or timer job that adds or updates each script against farm level SPPersistedObjects. I've been half tempted to make a PowerShell Provider to work against them to make script execution easier. The other option is to make a timer job sync the files to the file system whenever they change in the doclib.

Mar 25, 2010 at 5:24 PM

Has anyone been able to get this to work? I am very new to powershell and I have found  this webpart to be very handy. But I would like to store my powershell scripts in the library so I can reference them there rather than have them in each page. But I could sure use an example of how to import a power module and then reference it.

I am currently using  Import-PowerModule -name mymodule

Then in the render I am trying to run the function from the imported module. But it does not recognize the function from the module. Not sure if the import is not working or if I am note referencing it correctly.

Aug 11, 2011 at 1:08 PM

Summary to use import-PowerModule

If you have followed the user guide to install and configure the web.config...

1 Define the location where are stored Power Modules

Central Administration > Application Management - I Love Sharepoint : PowerWebPart 3.0 Settings
Define "PowerWebPart Modules" the link to the Document library where powershell module will be stored
example http://MySharepoint/MySite/MyPowershells

2 Sample Module

Create a script file demo_module.ps1 and stored it in http://MySharepoint/MySite/MyPowershells
It must be a .ps1 file

function global:demo_hello
    return "HELLO"

3 Call the Function from the PowerWepart

Create a page with the Power Web Part

# Import the module from the file name without extension
Import-PowerModule -name demo_module

function Render($writer)
   $writer.Write("$(demo_hello) </br>")

Have fun with this nice product