Jump to content
Sign in to follow this  

Check if Service on Remote Server is Stopped

Recommended Posts



I need you help with a script I'm writing. I need to stop a service on on of my servers (that part is working) and then need to make sure the script only continues once the service is stopped.

I would like to avoid SLEEP

I was trying something like this juts to get you an idea:

Until $oShell.ServiceStop(spooler)

Problem is, ServiceStop doesn't work that way and I have no idea how I would do this on a remote server.

Any idea or suggestion would be highly appreciated.




Share this post

Link to post
Share on other sites

What COM object is $oShell using?  ...assuming shell.application

You could use the command-line exe SC to work with remote (or local) services.  Be sure that the account you are using has rights on the remote machine.

Edited by spudw2k

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this