- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2026 04:44 AM
Hi all,
is it possible to execute a MID Server Script File as an other user (like runas on shell)?
Script is powershell created on: MID Server > Script Files
Thanks for the help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Thank you all.
We finally figured it out: instead of running the script directly, we ran a scheduled task that, in turn, executes the script with another user's privileges.
Example:
var task = 'name-of-scheduled-task';
ecc.payload = '<?xml version="1.0" encoding="UTF-8"?><parameters><parameter name="name" value="C:\\Windows\\System32\\schtasks.exe /run /tn "'+task+'""/><parameter name="skip_sensor" value="true"/></parameters>';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2026 04:46 AM
@Emanuele Zof Yes, it is possible to execute a PowerShell script from MID Server > Script Files as another user, though it requires specific configuration because the MID Server service normally runs scripts using its own service account.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2026 04:51 AM
Great, what settings should I adjust, and where can I do that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2026 05:06 AM - edited 05-06-2026 05:09 AM
Refer :
Execute Powershell Script from ServiceNow
https://www.youtube.com/watch?v=6yW-3eXMT7o
How to setup MID server windows service to use specific user
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Thank you all.
We finally figured it out: instead of running the script directly, we ran a scheduled task that, in turn, executes the script with another user's privileges.
Example:
var task = 'name-of-scheduled-task';
ecc.payload = '<?xml version="1.0" encoding="UTF-8"?><parameters><parameter name="name" value="C:\\Windows\\System32\\schtasks.exe /run /tn "'+task+'""/><parameter name="skip_sensor" value="true"/></parameters>';