在远程计算机上重新启动服务的最简单方法 [英] Simplest way to restart service on a remote computer

查看:24
本文介绍了在远程计算机上重新启动服务的最简单方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在远程 Windows 系统上重启服务的最简单的编程方式是什么?语言或方法无关紧要,只要不需要人际互动即可.

解决方案

从 Windows XP 开始,您可以使用 sc.exe 与本地和远程服务交互.安排一个任务来运行一个类似于这样的批处理文件:

<前>sc \\服务器停止服务sc \\服务器启动服务

确保任务在目标服务器上具有特权的用户帐户下运行.

psservice.exe 来自 Sysinternals PSTools 也将完成这项工作:

<前>psservice \\服务器重启服务

What's the easiest programmatic way to restart a service on a remote Windows system? Language or method doesn't matter as long as it doesn't require human interaction.

解决方案

As of Windows XP, you can use sc.exe to interact with local and remote services. Schedule a task to run a batch file similar to this:

sc \\server stop service
sc \\server start service

Make sure the task runs under a user account privileged on the target server.

psservice.exe from the Sysinternals PSTools would also be doing the job:

psservice \\server restart service

这篇关于在远程计算机上重新启动服务的最简单方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆