Unable to Load PowerBoots

Jun 24, 2009 at 8:34 PM
Edited Jun 24, 2009 at 8:36 PM

I've now tried this on two systems: XP SP3 and a 2008 machine. I've installed Powershell 2 CTP3 and added the PowerBoots module to %SystemRoot%\system32\windowspowershell\\v1.0\Modules. I've also set my execution policy to unrestricted for the time being.

On both systems, I get the following error when I try to import the module

Import-Module PowerBoots
Import-Module : An item with the same key has already been added.
At line:1 char:14
+ Import-Module <<<<  PowerBoots
    + CategoryInfo          : NotSpecified: (:) [Import-Module], ArgumentException
    + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ImportModuleCommand
 

If I do a "Get-Command -Module PowerBoots" I get a list of commands. If I do a "New-BootsWindow -SizeToContent WidthAndHeight -Content (
   Button -Content "Push Me"
)"

I get - 
WARNING: Button not invoked in PowerBoots context. Attempting to reinvoke.
New-BootsWindow : Cannot bind parameter 'Content'. Cannot convert the "System.Windows.Controls.Button: Push Me" value of type "System.Windows.Controls.Button" to type "System.Management.Automation.ScriptBlock".
At line:1 char:55
+ New-BootsWindow -SizeToContent WidthAndHeight -Content <<<<  (
    + CategoryInfo          : InvalidArgument: (:) [New-BootsWindow], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,PoshWpf.NewBootsWindowCommand

 

 

 Any idea on what's going wrong here?

Coordinator
Jun 25, 2009 at 2:28 AM

Yep!

1st: the error in the Import-Module is expected on CTP3 -- it's a CTP3 bug, but it doesn't cause any problems (except the error message).

2nd: -Content takes a script block, not a Button. So you need to use curly braces, not parenthesis.

New-BootsWindow {
   Button "Push Me"
}

Jun 25, 2009 at 11:42 AM

Thanks!

The code that with the parens is from the tutorial that's linked to on the front page. I see that every subsiquent code example uses curly braces instead.

Now I can start playing around with this. Thanks again..

Coordinator
Jun 25, 2009 at 1:09 PM
I'm sorry about that tutorial ... I obviously need to update the examples in it to match the one in the samples.ps1 script included with this latest release.

rchiav wrote:

From: rchiav

Thanks!

The code that with the parens is from the tutorial that's linked to on the front page. I see that every subsiquent code example uses curly braces instead.

Now I can start playing around with this. Thanks again..