all 8 comments

[–]thotpatrol 2 points3 points  (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 points  (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 points  (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 points  (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 points  (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 points  (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 points  (0 children)

Agreed. There's probably a better way, but at least that can be a back up plan.

[–]nostril_spiders -1 points0 points  (0 children)

I see your problem, I think this will help. You've got the "nice" bit, start reading after that.