Question
Atos
IN
Last activity: 11 Mar 2020 11:48 EDT
How to interrogate Windows PowerShell using Pega Robotics?
Hi,
I have a need to automate running commands in PowerShell. I have used Windows adapter and given powershell.exe with full path in Path property. But i am unable to interrogate anything on it. then given powershell_ise.exe with full path in Path property, now i can able to interrogate the frame. but no test methods are working. Pls find below for the error message when trying to invoke test methods.
Any help would be high appreciated
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Updated: 11 Mar 2020 11:48 EDT
Atos
IN
when i was running powershell script manually, it was working fine.. issue was only when running using robotics. so in PS script, i have placed escape characters before quote/special characters.and passed that as arguments.it worked
Pegasystems Inc.
US
You wouldn't automate Powershell via interrogation. Since it is a scripting language, you'd just execute the script you wanted to run using a static method from the Global Assembly Cache (Process.Start).
To add that Static method to your automation; right-click the Toolbox and select Choose Items. Select the "Pega Robot Static Members" tab and choose the "From Global Assembly Cache" radio button. Select the "System" assembly and then select the "Process" node, then the "Start" method and click OK. You can now drag this method to your automation to call your script.
-
Tejaswini Silivear
Atos
IN
Thank you tsasnett for the reply.
I have used process and given FileName as powershell.exe and Arguments as "arg1"; "arg2"
however its just opening powershell and closing it.
Pegasystems Inc.
US
You might not be able to use Process.Start. You may need to use a C# script (add a script object from the Toolbox to your Global Container and edit it).
https://duanenewman.net/blog/post/running-powershell-scripts-from-csharp/
Atos
IN
it was done without using C# script. issue was with passing arguments. Have placed escape characters at right place, its working now. Thanks a lot for your timely help
Boubyan Bank
KW
Hello Tejaswini ,
please brief us , how you did( without C# ) and what exactly you meant with correct placing of escape characters.
Accepted Solution
Updated: 11 Mar 2020 11:48 EDT
Atos
IN
when i was running powershell script manually, it was working fine.. issue was only when running using robotics. so in PS script, i have placed escape characters before quote/special characters.and passed that as arguments.it worked
Pegasystems Inc.
IN
Hello!
Thank you for sharing the solution. I have marked this as the Accepted Solution. If you find this incorrect, please click the ellipsis and choose Remove Solution.
Regards,
Pallavi M | Moderator | Pega Collaboration Center