SCCM Orchestrator & powershell oddity

Damian Yates 0 Reputation points
2021-08-16T21:38:37.363+00:00

I am trying to execute a powershell script in Orchestrator. It runs just fine in the Runbook tester but fails to execute properly when running at the runbook servers.

$timestamp = (get-date).AddDays(-1).tostring("MMddyyyyHHmm")
$file = "\\dhqdeveamsql11\EAM\alchemy.dat"
if (-not(Test-Path -Path $file -PathType Leaf)) {

     $p= start-process "C:\Program Files (x86)\GnuPG\bin\gpg.exe" -ArgumentList "--output \\Server1\EAM\alchemy.dat --decrypt \\Server1\EAM\pgp\alchemy.dat.pgp" -PassThru -wait
     $Exitcode = $p.ExitCode
     }else 
  # If the file already exists, Move to archive.
    {
     $newfile = "\\Server1\EAM\Archive\alchemy" +$timestamp +".dat"
     mv $file $newfile
     $p= start-process "C:\Program Files (x86)\GnuPG\bin\gpg.exe" -ArgumentList "--output \\Server1\EAM\alchemy.dat --decrypt \\Server1\EAM\pgp\alchemy.dat.pgp" -PassThru -wait
     $Exitcode = $p.ExitCode 
            }

When the code is run in Orchestrator, it fails to run the gpg.exe process successfully. I have confirmed that permissions to the folder and the gpg.exe file are correct. When executed as the Orch srv account, when executed locally on either runbook server, or when executed in the runbook tester, the script completes without error and performs as expected. However when run as a checked in runbook, it executes without error but does not place the decrypted file the remote share.

System Center Orchestrator
System Center Orchestrator
A family of System Center products that provide an automation platform for orchestrating and integrating both Microsoft and non-Microsoft IT tools.
219 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. XinGuo-MSFT 16,246 Reputation points
    2021-08-18T07:44:54.19+00:00
    0 comments No comments