Kinook Software Forum

Kinook Software Forum (https://www.kinook.com/Forum/index.php)
-   [VBP] General Discussion (https://www.kinook.com/Forum/forumdisplay.php?f=2)
-   -   Logging PowerShell action script (https://www.kinook.com/Forum/showthread.php?t=5394)

dorrellg 11-20-2015 09:41 AM

Logging PowerShell action script
 
When using the PowerShell command within VBP, if you enter a script, when it is executed, VBP creates a tmp.ps1 file. Is there anyway to get this temp PS1 file? We'd like to keep a record of exactly how the PS code looks when it is executes. It also helps for debugging and troubleshooting processes.

In the example output below, you can see that all we have is that a tmp PS1 file was executed. There could've been 50 commands in the file, and we'd like to see what they are. Can we redirect input/output of the PS1 file?

Any help would be greatly appreciated.

Example Output:
11/20/2015 3:23:16 PM: Building project step 'Check-Create container if it does not exist'...
C:\Windows\System32\WindowsPowerShell\v1.0\powersh ell.exe -nologo -noninteractive -executionpolicy Unrestricted "& C:\Users\a212314650\AppData\Local\Temp\VisF783.tmp .ps1"

NOTE: I am using V8.6

kinook 11-20-2015 10:04 AM

The Script field of the PowerShell script is stored in the CmdStr step property, which is the default property for that action, so if you have Tools | Application Options | Logging | Log default property of each step checked, it will be logged when the step is built.

http://www.kinook.com/VisBuildPro/Manual/loggingopt.htm

Otherwise, you could log it yourself in the vbld_StepStarted script event like so:

Builder.LogMessage "PowerShell command = " & vbld_StepProp("CmdStr", vbString)

http://www.kinook.com/VisBuildPro/Ma...riptevents.htm

dorrellg 11-20-2015 01:28 PM

Option #2 worked perfect, thank you!

Option #1 worked half way, as it would cutoff the output half way and end with a "..."

Thank you so much for the help!!

kinook 11-20-2015 10:19 PM

In the latest build (VisBuildSvr.dll 9.2.0.1), it now defaults to a max of 5000 rather than 500 characters for the default property length to log, which also can now be overridden via the MaxDefaultPropertyLogLength application option in the object model (a value of 0 will not truncate).


All times are GMT -5. The time now is 03:43 PM.


Copyright © 1999-2023 Kinook Software, Inc.