开发者

Changing account name and password on Windows Services remotely

开发者 https://www.devze.com 2023-01-21 02:45 出处:网络
I need to wr开发者_如何学Pythonite a program / script to change the account name and password on certain services running on a remote server. I intend to do it with Powershell. Is that the best soluti

I need to wr开发者_如何学Pythonite a program / script to change the account name and password on certain services running on a remote server. I intend to do it with Powershell. Is that the best solution or is there something else that would be more suitable?

A quick google search brought up this script:

$account="domain\userName"
$password="password"

$svc=gwmi win32_service -filter "name='alerter'"
$svc.change($null,$null,$null,$null,$null,$null,$account,$password,$null,$null,$null)

Am I mistaken in thinking the above script works on the local machine? If that is true, how do I do the same for a service on a remote machine?


The command is running on your local machine. Use the -ComputerName parameter to run it on remote systems.

$svc=gwmi win32_service -filter "name='alerter'" -ComputerName Server1,Server2

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号