在 powershell 中通过 IP(不是主机名)重命名机器

Rename machine by IP (not hostname) in powershell

我正在处理这样一种情况,即有 2 台机器具有相同的主机名和不同的 IP。其中之一需要重命名。我发现可以使用下一个命令远程重命名机器:

Rename-Computer -ComputerName "Srv01" -NewName "Server001" -LocalCredential Srv01\Admin01 -DomainCredential Domain01\Admin01 -Force -PassThru

但是这个接受主机名而不是 IP。 任何帮助将不胜感激。

来自the docs

-ComputerName

Renames the specified remote computer. The default is the local computer.

Type the NetBIOS name, an IP address, or a fully qualified domain name of a remote > computer. To specify the local computer, type the computer name, a dot (.), or localhost.