How can I programmatically stop/start a windows service on a remote box?

后端 未结 9 1747
清歌不尽
清歌不尽 2020-11-27 05:17

I want to write a console or Click Once WinForms app that will programmatically stop and/or start a windows service on a remote box.

Both boxes are running .NET 3.5

9条回答
  •  再見小時候
    2020-11-27 05:28

    ServiceController.

    You need to have permission to administer the services on the remote box.

    As Mehrdad says, you can also use WMI. Both methods work for start and stop, but WMI requires more coding and will give you more access to other resources

提交回复
热议问题