Execute PowerShell on Service Portal Request form

Dazler
Mega Sage

Hi,

 

I have been tasked with creating a form that will execute a PowerShell to return a csv template.  I know that I can store templates on the catalog item as an attachment and retrieve it that way, unfortunately, the template changes often.  This is why I have to execute a PowerShell to retrieve the data and user script to turn it into a csv.

 

Does anyone know the best way to achieve this?

1 ACCEPTED SOLUTION

Peter Bodelier
Giga Sage

Without knowing the specifics and assuming you want this to be visible on a catalog item in a Service Portal:

You would have to create a portal widget and leverage that in a variable (type custom).

I would personally prefer to call a flow designer flow from that widget to retrieve what is necessary using integration hub, and the use the output to display in the widget, but there may be other ways.

 


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@Dazler 

for executing powershell you need to have mid server setup.

where is that csv file present? is it in windows machine?

check these links on how to bring file from mid server

File Import (CSV / XLS) file from Mid Server location

CSV file from MIDserver to ServiceNow instance

How to import excel file from Mid Server to import set table in service now.

How to import a CSV file from a MID Server

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Peter Bodelier
Giga Sage

Without knowing the specifics and assuming you want this to be visible on a catalog item in a Service Portal:

You would have to create a portal widget and leverage that in a variable (type custom).

I would personally prefer to call a flow designer flow from that widget to retrieve what is necessary using integration hub, and the use the output to display in the widget, but there may be other ways.

 


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Hi @Peter Bodelier,

 

So you are saying to call a flow instead of executing PowerShell?  Let Flow execute the PowerShell and retrieve the response as well as create the csv.  I like this idea.  Would I still use the widget to call the flow? 

@Dazler, yes, correct and yes you will need the widget to execute the flow. You could execute it from client script, but I don't think there would be a good way to present the csv that way.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.