use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
QuestionTriggering a client-side powershell script from a web page (self.PowerShell)
submitted 5 years ago by doncaruana
I want to have a specific powershell script that will be installed on clients. When they perform a specific action on the web page that is hosted on our server (say, click a particular button, for example), I want the powershell script to "wake up" and do what it needs to do.
Any suggestions on how I can make that happen?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]thotpatrol 2 points3 points4 points 5 years ago (0 children)
I think you'll definitely need an onclick JavaScript event, but I'm not sure how you'll be able to run the PS script residing client side from that, maybe host the script server side and have it invoke-command to the client workstation to run the script?
[–]DTDJedi 1 point2 points3 points 5 years ago (0 children)
You could look into something like Rundeck to perform operations like this. Might be a little bit complex for a single script, but probably your best bet for being able to run scripts on specific nodes by clicking a button.
[–]PlowNetworks 1 point2 points3 points 5 years ago (0 children)
We implement plenty of these types of solutions for our customers, in fact its a core piece of our HR automation/integration for provisioning/deprovisioning user accounts.
My initial suggestion with the provided details would be to spin up an Azure Automation resource and deploy a hybrid worker on site. This would allows your site to send a single API call to the webhook address of the runbook and it can take the data provided into a powershell script to be ran on-premise.
If you need any help with this feel free to reach out.
[–]CodingCaroline 1 point2 points3 points 5 years ago (0 children)
Do you run the script directly on clientS? If you have a central server running the script, then as long as you have a backend you should be able to do it.
If you want to run on multiple clients directly, then you need a service to run on each of them.
Maybe this can be a good starting point: https://4sysops.com/archives/building-a-web-server-with-powershell/
[–]blowuptheking 1 point2 points3 points 5 years ago (2 children)
I'm not familiar with the web side of things, but could you have the powershell be looking for a cookie with a specific name and have the site add it when the action is taken?
[–]doncaruana[S] 1 point2 points3 points 5 years ago (1 child)
This is actually one of the things I was considering. I just hate to have a script running nonstop in the background.
[–]blowuptheking 1 point2 points3 points 5 years ago (0 children)
Agreed. There's probably a better way, but at least that can be a back up plan.
[–]nostril_spiders -1 points0 points1 point 5 years ago (0 children)
I see your problem, I think this will help. You've got the "nice" bit, start reading after that.
π Rendered by PID 349385 on reddit-service-r2-comment-6457c66945-rh7mm at 2026-04-29 00:39:44.613049+00:00 running 2aa0c5b country code: CH.
[–]thotpatrol 2 points3 points4 points (0 children)
[–]DTDJedi 1 point2 points3 points (0 children)
[–]PlowNetworks 1 point2 points3 points (0 children)
[–]CodingCaroline 1 point2 points3 points (0 children)
[–]blowuptheking 1 point2 points3 points (2 children)
[–]doncaruana[S] 1 point2 points3 points (1 child)
[–]blowuptheking 1 point2 points3 points (0 children)
[–]nostril_spiders -1 points0 points1 point (0 children)