I tried your test script and at least on my Win2016 server running HealthShare 2017 in PowerShell, and none of the tests passed on my system. However... if you triple-quote the triple-quotes, I was able to get it to run. So, the test argument was:
Name = "Triple-Triple Quotes"
Pattern = 'Say^ImplUtil("""""""""' + $TestString + '""""""""")'
But... my original $TestString didn't have any spaces in it. Once I added spaces, it failed both the 'Triple Quotes' and the 'triple-triple quotes' tests... so with a bit more tinkering, I changed this:
$TestString = '"""Your String Here"""'
and it passed the Triple Quote test but failed the Triple-Triple Quote test... so it looks like if the string has spaces you need six quotes on each side of the string, but if not you need nine.
I have not yet found a delimiter that would work in both cases (string with & without spaces) but I'll keep tinkering as I have time...
To help visualize how this is being evaluated, maybe it'll help if we break it down in the order it's being evaluated. An equivalent statement for the strict left-to-right evaluation would be this:
W (((1=0) && 1) = 0) ; nested operations in different text color.
So, to evaluate (1=0) first, 1=0 is false, therefore the result is zero.
That now makes the full equation:
W ((0 && 1) = 0) ;
Now, let's evaluate (0 && 1) -- 0 && 1 equates to zero also.
That now makes the full equation:
W (0 = 0) ; last nested part of the equation;
So, lastly, the result of 0=0 is true, or 1.
I hope this explanation helps!



OK, I think I figured out a way that seems to work with both spaces & non-spaces in the strings...
You need to use the "Stop Parsing" token available in powershell: --%
With that, and the usual delimiting with double quotes in strings (I couldn't get it working with outer single quotes at the PS command prompt), this does seem to work:
# So, you can run the script this way (at the command line): .\irissession healthconnect -U user --% "Say^ImplUtil(""""""Your string here"""""")"
and it should work. In your script, you would need to make these modifications:
[string]$TestString = "Test_string_without_spaces" # or to test with spaces [string]$TestString = "Test string with spaces" # In the escape test: Name = "Double-Triple quotes" Pattern = 'Say^ImplUtil(""""""' + $TestString + '"""""")' # and because we're changing how we parse the string when calling it, # we need to add a secondary stage when parsing the command. In the first # try loop after the foreach, change your code to this: $zparams = ' --% ' + $test.Pattern + ' 2>&1' # Test the pattern $result = .\irissession $Instance -U user $zparams # Should be the end of the modifications...
Note: My instances and namespaces are quite a bit different than yours, so I tried to adjust things back to how you had it from my testing, but if I wasn't quite successful, I apologize for any missteps.
Hope this helps!