Powershell issues running script from Windows Service 02/02 - job information is not available

Occasional Contributor


I am facing problems executing some powershell scripts from a Windows Service.



The Windows Service (started with an AD user) will execute a command (through Process Class).

It will launch a command like in the folder that we specify:

  • powershell .\<script name>.ps1 -param1 'param1' -param2 'param2'...

The <script name>.ps1 uses the cmdlet Start-Job to execute a ssh script in a Linux server.



Some information from the ChildJobs is not available after the jobs execute. E.g.:

  • Error property.
  • JobStateInfo.Reason property.

If we run the same command from a Command Prompt, we are able the get that information when the job fails!


We are iterating the failed jobs using:

Get-Job -ChildJobState Failed | ForEach-Object \{
  <error handling>





Thanks in advance,

Tiago R.



1 Reply
best response confirmed by tarente (Occasional Contributor)
The problem was that powershell was executing in 32-bits thru the service and in 64-bits when launched from the command prompt.
I copied the code in described in to the beginning of the script and now works as expected.