I created complex forms application in powersheel and it is running correctly in Powershell ISE and powershell console too, but there is little difference in behaviour:
when I run application by double clicking in windows explorer, powershell console opens, but there is toooo much of "debug" data from creating all form controls(checkboxes, labels, buttons...). It takes too long to start and it looks like this:
TextImageRelation : Overlay UseMnemonic : True UseCompatibleTextRendering : True UseVisualStyleBackColor : True AccessibilityObject : ControlAccessibleObject: Owner = System.Windows.Forms.CheckBox, CheckState: 0 AccessibleDefaultActionDescription : AccessibleDescription : AccessibleName : AccessibleRole : Default AllowDrop : False Anchor : Top, Left AutoScrollOffset : {X=0,Y=0} LayoutEngine : System.Windows.Forms.Layout.DefaultLayout BackgroundImage : BackgroundImageLayout : Tile BindingContext : {} Bottom : 208 Bounds : {X=165,Y=190,Width=96,Height=18} CanFocus : False CanSelect : False Capture : False CausesValidation : True ClientRectangle : {X=0,Y=0,Width=96,Height=18}
This output is not in powershell ISE(there is none) - there application starts immediately.
I was not able to resolve this issue and I would like to remove debug output when run from console, if it is possible - to speed up script start.
Script source code is same as examples on internet, for example like this: https://learn.microsoft.com/en-us/powershell/scripting/samples/creating-a-custom-input-box?view=powershell-7
I tried yo add | Out-Null to some controls/rows - which i saw in logs, but it did not help.
Also I tried to identify which command is making output by manually adding some controls to console, but none generated that output.
I tried to create ISE profile and load it in script run from console, but it did not help, because created profile file was empty.
If I run new console window like this:
start-process powershell -argumentlist "-noexit", "-noprofile" and run script from that, it works without logs.
But if I run script like this:
start-process powershell -argumentlist "-noexit", "-noprofile", "-command $path"
it outputs logs again.
Any ideas how to do it? What should I check/modify.
Thank you.