1

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.

3
  • 1
    Omg, I found out what it was. I was preparing some example script to add it here and space in script name is making this log output.If I removed it there was no log output. That is really sad, I spent so much time by troubleshooting. Commented Oct 28, 2020 at 21:09
  • Sorry to hear :/ If you solved the issue you can write an answer to your own question. Maybe you can help someone else that way. Commented Oct 28, 2020 at 21:47
  • 2
    But it happens often that preparing the code to post here helps solving the problem :) Commented Oct 28, 2020 at 21:48

1 Answer 1

1

solved: problem was a space in script name as I mentioned in comment.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.