PowerShell function invoke/ call using C# code using Code stage
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
09-09-21 06:33 PM
Hi!
I am facing issues while running my process from control room. I have an object with a code stage where the the coding is done in C# which basically invokes/ executes/ call the PowerShell Module/ function that is in the machine database or pushed to the VDI. The codes runs perfectly fine when I run the process in debug mode (Process studio) however if I run the same code with same parameters, I get the following error.
"Exception Details :The term 'UserList' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."
This is on the same machine and with the same user so I assume it has nothing to do with the access. Can someone help me with the issue. Thanks!
Parameters passed for the function is as follows:
csvfile=C:\Temp\ADD_Users\Input_File_Add_Users\Input_File_Add_Users_20210909.csv,Name=Previous,csvariable=DL_Name,LogLocation=C:\Temp\ADD_Users
Module and function name is as follows:
userlist
This is the same value to the code stage while running from Process studio and also from control room (Retrieved from Logs).
Any help here would be great help. Thanks!
------------------------------
Sivakumar TK
Sr. Software Developer
------------------------------
I am facing issues while running my process from control room. I have an object with a code stage where the the coding is done in C# which basically invokes/ executes/ call the PowerShell Module/ function that is in the machine database or pushed to the VDI. The codes runs perfectly fine when I run the process in debug mode (Process studio) however if I run the same code with same parameters, I get the following error.
"Exception Details :The term 'UserList' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."
This is on the same machine and with the same user so I assume it has nothing to do with the access. Can someone help me with the issue. Thanks!
Parameters passed for the function is as follows:
csvfile=C:\Temp\ADD_Users\Input_File_Add_Users\Input_File_Add_Users_20210909.csv,Name=Previous,csvariable=DL_Name,LogLocation=C:\Temp\ADD_Users
Module and function name is as follows:
userlist
This is the same value to the code stage while running from Process studio and also from control room (Retrieved from Logs).
Any help here would be great help. Thanks!
------------------------------
Sivakumar TK
Sr. Software Developer
------------------------------
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
13-09-21 05:28 PM
Hi @Sivakumar TK,
When you run the process in debug how are you setting the parameters vs when you run it from Control Room? Are they hardcoded in the process when you run it in debug?
Cheers,
------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------
When you run the process in debug how are you setting the parameters vs when you run it from Control Room? Are they hardcoded in the process when you run it in debug?
Cheers,
------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
14-09-21 10:48 AM
Hi Eric,
Appreciate for taking time and looking into this.
The parameters are as below passed to the object.
"csvfile="&[Add Users_Input File Name & Path]&".csv,Name=Previous,csvariable=DL_Name,LogLocation=C:\Temp\ADD_Users"
These data items values would be below.
csvfile=C:\Temp\ADD_Users\Input_File_Add_Users\Input_File_Add_Users_20210909.csv,Name=Previous,csvariable=DL_Name,LogLocation=C:\Temp\ADD_Users
Basically depending on the items from Queue these values get set.
I tried same items after force retry in Queue so the result/ parameter (data items) values passed is same.
It worked in debug mode but errored if run in control room. Error is given below.
"Exception Details :The term 'UserList' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."
------------------------------
Sivakumar TK
Sr. Software Developer
PPD
Asia/Kolkata
------------------------------
Appreciate for taking time and looking into this.
The parameters are as below passed to the object.
"csvfile="&[Add Users_Input File Name & Path]&".csv,Name=Previous,csvariable=DL_Name,LogLocation=C:\Temp\ADD_Users"
These data items values would be below.
csvfile=C:\Temp\ADD_Users\Input_File_Add_Users\Input_File_Add_Users_20210909.csv,Name=Previous,csvariable=DL_Name,LogLocation=C:\Temp\ADD_Users
Basically depending on the items from Queue these values get set.
I tried same items after force retry in Queue so the result/ parameter (data items) values passed is same.
It worked in debug mode but errored if run in control room. Error is given below.
"Exception Details :The term 'UserList' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."
------------------------------
Sivakumar TK
Sr. Software Developer
PPD
Asia/Kolkata
------------------------------
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
14-09-21 02:59 PM
@Sivakumar TK,
It doesn't seem like the variables are the issue as much as the actual command reference. I assume 'UserList' is the name of the PowerShell script/cmdlet you're trying to run? When you run this from Control Room are you running it against a runtime resource on the same machine as you are debugging on?
From what I can see in a few Microsoft articles this error usually implies the associated PowerShell module isn't available for some reason. Is this a custom PowerShell script you wrote? Can you share your actual C# code?
Cheers,
------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------
It doesn't seem like the variables are the issue as much as the actual command reference. I assume 'UserList' is the name of the PowerShell script/cmdlet you're trying to run? When you run this from Control Room are you running it against a runtime resource on the same machine as you are debugging on?
From what I can see in a few Microsoft articles this error usually implies the associated PowerShell module isn't available for some reason. Is this a custom PowerShell script you wrote? Can you share your actual C# code?
Cheers,
------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------
