I’ve narrowed this down to the script arguments. If I remove the arguments altogether, or set them to simple text values, the step runs fine. But I need to pass variables from the “Get List of Identities” step as the arguments.
I can see the variable populating in the Windows Server step input, so no issues there, but I there’s something about it being an array that it doesn’t like. Maybe just some syntax weirdness?
can you check if your script actually accepts an array of string? Just run the poweshell script natively with out workflow by passing an array and validate the outcome or error
Get List of Identities returns a real JSON array, but the Windows Server “Execute PowerShell Script” action’s Script Arguments behave like string name/value pairs. When you “Choose Variable” you’re sending an array type and the step fails.
serialize the array to a string on the workflow side, then deserialize in PowerShell. In the Script Arguments use Enter Value and set:
usersJson = {{$.getListOfIdentities.identities[*].attributes.addn.JSON()}}
(.JSON() forces a raw JSON string)
Ensure there is no leading newline/whitespace before the [ (your Step Input shows a \n before [), because some remoting layers are surprisingly sensitive.Keep the
argument as Enter Value and force it to be one scalar string all the way through.
I’ve got a workaround in place that seems to be working, by putting the Windows Server action inside a Loop. That way it iterates through the list of identities and feeds them to the Powershell script one-by-one.
I’m not a huge fan of it running the script multiple times when PS is completely capable of doing it all at once (especially if/when the list is long), so if anyone has any more ideas for getting the array in the proper format to feed it to Powershell, I’m all ears!