Product, version and build:studio 2015
32 or 64 bit version of product:64 bit
Operating system: win server 2008 r2
32 or 64 bit OS: 64
I am not having any luck getting a transcript in a wonforms script to work as expected.
Is there a recommended way to get a transcript type log from a winform script? I don't expect to see a transcript of all the users interactive winform activity, but I'd like to get a complete transcript of all the powershell script execution up to the moment the winform opens.
I have written scripts completely by hand that run winforms and in those start-transcript outputs a very useful and verbose transcript.
thanks,
ken
transcript from winform script
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: transcript from winform script
[POST MOVED TO POWERSHELL GUI FORUM BY MODERATOR]
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- LtMandella
- Posts: 61
- Last visit: Mon May 07, 2018 4:03 pm
Re: transcript from winform script
Hi jvierra,
Here is what I am doing to get this to work. Probably I am doing it all wrong and there is a better way
I want to audit ALL possible errors and a numerous object properties, arbitrary text from output inside the functional script, etc. So my usual practice is to always call my "functional" script from a parent "logging" script.
Basically the "parent" script will always look like this:
---------------------------------------------------------
Start transcript -path c:\blah\auditfilename.txt
Invoke-Expression "\\somepath\somefunctionalscript.ps1 `'$inputList`' `'$CommaListParams`'"
Stop-Transcript
--------------------------------------------------------------
This way even if the functional script won't compile/execute, I still capture and persist useful info about the problem.
To make this work with a winform script, I have to hack the .psf file after export of the .ps1 and remove the "Out-Null" from the call to the .psf at the end of the generated .ps1 export file.
Is there a better way?
thank you!
Ken
p.s. pshell studio 2015 is one of the best tools I have ever used (in a long career)...
Here is what I am doing to get this to work. Probably I am doing it all wrong and there is a better way
I want to audit ALL possible errors and a numerous object properties, arbitrary text from output inside the functional script, etc. So my usual practice is to always call my "functional" script from a parent "logging" script.
Basically the "parent" script will always look like this:
---------------------------------------------------------
Start transcript -path c:\blah\auditfilename.txt
Invoke-Expression "\\somepath\somefunctionalscript.ps1 `'$inputList`' `'$CommaListParams`'"
Stop-Transcript
--------------------------------------------------------------
This way even if the functional script won't compile/execute, I still capture and persist useful info about the problem.
To make this work with a winform script, I have to hack the .psf file after export of the .ps1 and remove the "Out-Null" from the call to the .psf at the end of the generated .ps1 export file.
Is there a better way?
thank you!
Ken
p.s. pshell studio 2015 is one of the best tools I have ever used (in a long career)...
Re: transcript from winform script
Ok - I see it. IK have always been unfavorable about this technique for launching a script. Maybe now we can get it fixed.
Not sure about this. Maybe the guys at Sapien can come up with a fix. I will flag them. Meanwhile can you post your issue to the Customer Service forum?
Not sure about this. Maybe the guys at Sapien can come up with a fix. I will flag them. Meanwhile can you post your issue to the Customer Service forum?
- LtMandella
- Posts: 61
- Last visit: Mon May 07, 2018 4:03 pm
Re: transcript from winform script
Thanks for the reply, I will post in customer service (although was it moved from there one time already?)
[[ I have always been unfavorable about this technique for launching a script]]
If you get a moment, could you recommend alternative?
thanks again,
ken
[[ I have always been unfavorable about this technique for launching a script]]
If you get a moment, could you recommend alternative?
thanks again,
ken
- Alexander Riedel
- Posts: 8488
- Last visit: Tue Apr 16, 2024 8:42 am
- Been upvoted: 37 times
Re: transcript from winform script
FYI, the customer service forum is not the correct place for product support.
The "Customer Service" forum is for non-product specific questions, e.g. your SAPIEN account.
The appropriate place is the forum for the specific product, in this case the "PowerShell Studio" forum.
viewforum.php?f=12
The "Customer Service" forum is for non-product specific questions, e.g. your SAPIEN account.
The appropriate place is the forum for the specific product, in this case the "PowerShell Studio" forum.
viewforum.php?f=12
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: transcript from winform script
Right now your workaround is the only one. Perhaps the programmers at Sapien can add an option to not use Out-Null. With Out-Null all output is tossed and does not get sent to the transcript engine. This is due to running a medal form which delays all output.LtMandella wrote:Thanks for the reply, I will post in customer service (although was it moved from there one time already?)
[[ I have always been unfavorable about this technique for launching a script]]
If you get a moment, could you recommend alternative?
thanks again,
ken
In many forms we like to grab the form object. It has long been my feeling that returning th form object on DialogResult::OK is more useful. This would alos preclude the need for Out-Null.
if($form.ShowDialog() -eq 'Ok'){ %form}
To detect result we can just:
- if($frm=Call-MyForm_psf){
- #process $frm - $frm contains all data
- }
Another workaround would be to generate a script file and run it in the CLI of PowerShell. It is still multi-step but does not require the manual edit.
Re: transcript from winform script
Sorry - I typed without thinking.Alexander Riedel wrote:FYI, the customer service forum is not the correct place for product support.
The "Customer Service" forum is for non-product specific questions, e.g. your SAPIEN account.
The appropriate place is the forum for the specific product, in this case the "PowerShell Studio" forum.
viewforum.php?f=12