Product: PowerShell Universal
Version: 5.5.2
When I use a specific variable (String, Stored in Database) in an automation it returns the specific value as expected (SQL01) but when this same variable is pulled in an API call, it exports a whole extra load of definition material I am using PS7 execution environment but it is also happening in Intergrated and PS5.1 environments. I have tested with Auth enabled and disabled but get the same response. Other variables (Secrets) are working fine
This is what I get doing a write-output of the variable instead of the the expected “SQL01”
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04">
<S>SQL01</S>
</Objs
I’ve not normally had an issue with this, but I remember one time I had to do $variable.value for some reason. Sorry I don’t have more specifics, it’s been a bit and I can’t quite rememeber what I was doing to go look for reminders.
@AMurphy-Leavitt is on the money from my experience too
if the variable name is TestVariable
then I use
$TestVariable
in scripts, and
Get-PSUVariable -Name "TestVariable" -ValueOnly
if I need to get it using the PS Cmdlets
Otherwise Get-PSUVariable returns the whole structure including the encoded value
Thanks @TriggerAu
I will look into this, I am getting a no response with the Get-PSUVariable for some reason, but I will continue to look into this
Further to this I have narrowed it down to scoping in the variable, if I use a Global scope variable then it returns correctly if its in a script scope it returns the entire value as shown in the first query