1

I've spent the better part of yesterday and this morning looking into this. I've come across Powershell, psexec, and WMI in my research. Nothing seems to work without having credentials of the second computer.

All I want to do is simply stop a service, and then start a service on another machine in the domain where I work. Without credentials, I keep getting "Access Denied" errors.

Does anyone know if this is possible without credentials? I'd prefer a Powershell suggestion, but I'll gladly listen to all suggestions.

4

1 回答 1

1

Get-Service可以使用、Stop-ServiceStart-Servicecmdlet轻松访问域内远程计算机上的 Windows 服务并对其执行操作...

$remoteService = Get-Service -ComputerName $remoteHost -Name $serviceName;
Stop-Service -InputObject $remoteService;
# Perform additional processing...
Start-Service -InputObject $remoteService;

...但是您需要成为$remoteHost. *-Servicecmdlet 不提供用于指定备用凭据的参数,因此它在用户运行时连接powershell.exe。即使您可以作为非管理员用户连接,您仍然需要成为管理员才能停止和启动服务。

于 2012-07-25T18:33:50.243 回答