Powershell activity.output empty when running from script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2015 08:15 PM
I am attempting to run a Powershell script and push stdout to activity.output. I have verified when writing the script that it writes to stdout, but when I run the script from a workflow activity.output returns blank. If I copy this script in as a command in the Run Powershell activity it works just fine. Any ideas on why the script itself wouldn't be pushing to stdout although I see it that way when running it manually on the server? When running from a script does it store output to a different variable? Or is there something I need to do in my script for SNOW to see the output?
Thanks in advance.
- Labels:
-
Orchestration (ITOM)
-
Service Mapping

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2015 08:27 AM
Hey Thomas!
What command(s) are you running? Does it work with other commands?
How are you trying to view the output, with gs.log or another method?
What is the output in the ECC queue? Is it blank?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2015 09:14 AM
Hey Mark,
Yeah right now I'm just attempting to read it with gs.log so that I can log the output and verify that it is returning what I expect.
$secpasswd = ConvertTo-SecureString "PASSWORD" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ("USER", $secpasswd)
$uri = "https://csapps.int.godaddy.com/Badger/api/Teams/"
$result = Invoke-RestMethod -Uri $uri -Method GET -Credential $cred
Write-Output ConvertTo-json @($result)
So I do the above to hit an NTLM rest API endpoint. Couldn't get the mid server to do rest auth for me any other way. If I put this in as a command it returns to activity.output without issue. If I run it via Mid Server Script however I don't get any data returned. Just shows up as blank, but show's that the execution was successful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2015 10:32 AM
Hrrm, so if I read that correctly. If you run this directly in a Run Powershell activity it works as expected, but if you move it to MID Script File and reference that, it does not?
If you change Write-Output to Write-Host does it make a difference?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2015 10:43 AM
Yeah tried that as well. When I run in powershell for testing Write-Output, Write-Host and just running the ConvertTo-json all push to stdout, but when running via the mid server script none of them return output.