ShowUI Function in Begin Block Does Not Run in PowerShell Console


When a ShowUI function is run from the begin block in a function in the PowerShell console, it will not load. The console is in STA mode with no modules other than ShowUI.

This does work properly in the ISE.
Closed Apr 26, 2013 at 4:56 AM by Jaykul


smurawski wrote Jul 22, 2011 at 6:12 AM

function test
    label test -show
    write-host "in process"

smurawski wrote Jul 25, 2011 at 6:38 PM

In my script, I'm creating a tab item with a header property. It appears that it cannot bind to that property.

From the pipeline trace - PipelineProcessor Information: 0 : Exception System.Management.Automation.ParameterBindingException: A parameter cannot be found that matches parameter name 'Header'.
at System.Management.Automation.CmdletParameterBinderController.VerifyArgumentsProcessed(ParameterBindingException originalBindingException)
at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidation(Collection1 arguments)
at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection
1 arguments)
at System.Management.Automation.CommandProcessor.BindCommandLineParameters(CommandParameterInternal[] parameters)
at System.Management.Automation.CommandProcessor.Prepare(CommandParameterInternal[] parameters)
at System.Management.Automation.CommandProcessorBase.DoPrepare(CommandParameterInternal[] parameters)
at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream)
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)

smurawski wrote Jul 25, 2011 at 6:44 PM

In further testing, it seems to be general problems with using the tabcontrol and tabitems in the powershell.exe host.

Jaykul wrote Aug 4, 2011 at 6:51 AM

I believe you're using PowerTab which has a conflicting New-TabItem function (which, by virtue of being a function, overrides our cmdlet, even though you load ShowUI 2nd). In ShowUI 1.2, if you use the alias "TabItem" it will resolve correctly, but you can also make sure by using this syntax: ShowUI\New-TabItem

smurawski wrote Aug 4, 2011 at 1:48 PM

Thanks Joel. That worked.