How to troubleshoot Running Powershell Script on Mid Server from Workflow/Flow Designer

Orlando Ruiz
Tera Contributor

I have successfully been executing a powershell script from a workflow that creates a user on 6 MID Servers and now I am receiving an error. However, the user is being created successfully on all MID Servers. The code is fine. There seems to be an issue with the mid server response. I have a delay set up to deal with async issues. I tried viewing the ecc_queue table to match the username in the payload but only the queue table shows and the sysid's  from the ecc_sysid returned from the insert call(see below) does not return any results. Is there another way to view this payload info to see why this error is being thrown. This is for work so any help would be appreciated.

Thank you

 

code to create user: (some code left out for brevity)

// if we ever add more term servers we simply increase the while loop to the number of servers
while (i <= 6) {
ecc_queue.initialize();
ecc_queue.agent = 'mid.server.T' + i + ' MID Server';
ecc_queue.name = 'Powershell.exe C:\\Scripts\\new-user.ps1 -ObjectName "' + newuser + '"';
ecc_queue.queue = 'output';
ecc_queue.topic = 'Command';
ecc_sysid[i] = ecc_queue.insert();
++i;
}

workflow.scratchpad.u_ecc_sysid1 = ecc_sysid[1];

 

code to verify user created: (some code left out for brevity)

var failures = [];

var query =
'payloadLIKEUser with the name ' +
user +
' created successfully^payloadLIKE ';

var ecc_test1 = new GlideRecord('ecc_queue');
ecc_test1.addEncodedQuery(query + ecc1);
ecc_test1.addQuery('queue', 'input');
ecc_test1.query();

if (ecc_test1.next()) {
gs.info('T1 user ' + user + ' was created successfully');
} else {
gs.info('T1 failed to create user!');
failures.push('t1');
}

0 REPLIES 0