• 0

Run an Ad Hoc PowerShell Command?


Tim King
 Share

Question

Is it possible to run a PowerShell command as needed without having to script out a datasource?

We have a 3rd party program running on the collector that periodically needs the Windows service restarted in order to apply an update.  I have over 50 collectors that we need to do this on a regular basis.  If I can accomplish this using the remote capabilities of LogicMonitor, it would be great.

I'm just looking to be able to run the PS command:        Stop-Service "servicename"     then confirm on a web portal that it is not communicating,   then send the command   Start-Service "servicename"

 

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Check Mike Suding's blog page -- lots of cool stuff, including this. A bit old, but probably still works :).

http://blog.mikesuding.com/2016/09/20/restart-a-service-alert-if-restart-fails/

As far as the debugger, yeah -- that stuff freaks me out a lot given that LM more or less requires Domain Admins on collectors (really should be Performance Monitoring Users, especially after the recent SolarWinds incident).  You can run those debugger commands from the API as well, even more scary.

Link to comment
Share on other sites

  • 0
  • Administrators

Sounds like you're looking for an orchestration tool. Ansible would fit this bill pretty nicely. The debug command would also work for you, but would almost be as rough as logging into each one.

Powershell has remoting capabilities. You could script the whole thing in powershell, then do a for loop to get through each server you want to restart the service on.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share