0 votes

I often need to step through a script in the ISE debugger to troubleshoot or verify its operation. My problem is that I haven't been able to find a way to do this with a script that's using the $Context variable as it's only available when the script is run via Adaxes in which case the script is hidden. Is there a way to interactively run a script uses the $Context variable so you can step through/debug it?

by (100 points)

1 Answer

0 votes
by (272k points)
selected by
Best answer

Hello,

$Context variable can be used only in PowerShell scripts executed by Business Rules, Custom Commands, and Scheduled Tasks. Currently, there is no possibility to use PowerShell debuggers.

To check values of variables, you can use the following code in your scripts:

$Context.LogMessage($myvar, "Information")

After script execution the value of $myvar variable will be displayed in the Execution Log.

Related questions

+2 votes
1 answer

Most of my PowerShell code is written in VS Code and then copied/pasted to the Adaxes script editor. However, if you use $Context in your scripts, you can't execute them ... = [Context]::new() $Context.LogMessage("foo", "information") Output: [Information] foo

asked Nov 3, 2023 by ngb (220 points)
0 votes
1 answer

Hello, We have a problem with the way Adaxes detects % as variables in all PowerShell scripts. We are configuring a HTML email template for all out going emails from the system ... this is a start of a variable. Is there anyway around this? Regards, ice-dog

asked Feb 22, 2019 by ice-dog (170 points)
0 votes
1 answer

We need to use two attributes for our new Cisco phone implementation. The ipphone attribute is being set with a 11 digit number that always starts with 91, but we need to ... way to strip the 91 off of the ipphone attribute and set it to otheripphone? Thanks

asked Aug 7, 2013 by jiambor (1.2k points)
0 votes
1 answer

Hi - I'm testing how granular we can get with reducing "non-necessary" access rights and would like to know if there are any logs we can check for more info on blocked ... it is very hit and miss trying to work out what access needs to be configured! Rgds

asked Jan 16, 2013 by firegoblin (1.6k points)
0 votes
1 answer

I am trying to send a $context.logmessage from a condition script in a Scheduled Task but I get nothing in the log. Is this not possible? Morten A. Steien

asked Jul 20, 2020 by Morten A. Steien (300 points)
3,342 questions
3,043 answers
7,764 comments
544,930 users