
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2021 03:35 PM
How to run PowerShell script from ServiceNow?
Hi,
I have a PowerShell script(.ps1) which imports the user ID's from the active directory and creates a csv file in Mid Server folder. Today I am running the script manually using the command prompt(PS>.\filename.ps1). This script file is in E:\Abc\ folder.
How can I run this command or directly execute the PowerShell script from ServiceNow so that csv created with user ID's in Mid Server?
Is anyone implemented similar solutions? Can you please advise?
#PowerShell #Automation
Solved! Go to Solution.
- Labels:
-
Orchestration (ITOM)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2021 03:50 PM
This link has some explanations that may help you
If this solved your issue, please mark this correct and helpful, thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2021 03:50 PM
This link has some explanations that may help you
If this solved your issue, please mark this correct and helpful, thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2021 11:55 PM
I think i have done this in past for a .BAT file , Very Old Days.
You can use Windows Task Scheduler to Schedule your script to RUN. TRY this way.
https://blog.netwrix.com/2018/07/03/how-to-automate-powershell-scripts-with-task-scheduler/
Hope this Helps.
Regards
RP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2021 09:51 AM
Hello,
We create our own PowerShell Discovery Probes and Sensors by copying factory Discovery Probes and Sensors. You can likely do the same for your own needs.
Example
Here are two examples of Trigger Probes that launch our own PowerShell Discovery Probes.
One of our Trigger Probes runs an ad-hoc PowerShell script and places the results in the Comments field of the associated server device.
Here is the Discovery Probe.
Here is the ad-hoc PowerShell script.
Here is the Discovery Sensor.
Does this help you?
Regards,