Jan 22 2021 02:54 AM
Hi,
I am facing problems executing some powershell scripts from a Windows Service.
Background
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:
The <script name>.ps1 uses the cmdlet Start-Job to execute a ssh script in a Linux server.
Issue
Some information from the ChildJobs is not available after the jobs execute. E.g.:
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>
\}
Workaround
None.
Thanks in advance,
Tiago R.
Jan 23 2021 11:44 AM
SolutionJan 23 2021 11:44 AM
Solution