roa*_*ima 5 powershell active-directory
我正在尝试重命名上周加入我们域的工作站。从那以后它至少重新启动过一次。
我的域基于 Windows 2012 R2,有问题的成员正在运行 Windows 10 专业版。如果这是有用的信息,我有三个 DC(是的,它们是同步的)。
重命名大部分时间都有效:
$aa = Get-Credential administrator@contoso.com
Rename-Computer -ComputerName mynewpc -NewName alpc001 -DomainCredential $aa
WARNING: The changes will take effect after you restart the computer mynewpc.
Run Code Online (Sandbox Code Playgroud)
但是我有几台机器顽固地拒绝重命名:
Rename-Computer -ComputerName otherhp -NewName alpc005 -DomainCredential $aa
Rename-Computer : Fail to rename computer 'otherhp' to 'alpc005' due to the following exception: Cannot create a file when that file already exists.
At line:1 char:1
+ Rename-Computer -ComputerName otherhp -NewName alpc005 -DomainCredent ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (otherhp:String) [Rename-Computer], InvalidOperationException
+ FullyQualifiedErrorId : FailToRenameComputer,Microsoft.PowerShell.Commands.RenameComputerCommand
Run Code Online (Sandbox Code Playgroud)
这是另一个尝试:
netdom renamecomputer otherhp /newname:alpc005 /ud:contoso\administrator /pd:*
Type the password associated with the domain user:
This operation will rename the computer otherhp
to alpc005.
Certain services, such as the Certificate Authority, rely on a fixed machine
name. If any services of this type are running on otherhp,
then a computer name change would have an adverse impact.
Do you want to proceed (Y or N)?
y
Cannot create a file when that file already exists.
The command failed to complete successfully.
Run Code Online (Sandbox Code Playgroud)
没有具有此新名称的计算机(或其他帐户),并且 AD DNS 中也没有相应的条目。
$error[0] | fl -f评论中要求的附加错误报告如下:
writeErrorStream : True
Exception : System.InvalidOperationException: Fail to rename computer 'otherhp' to 'alpc005' due to the following exception: Cannot create a file when that file already exists.
TargetObject : otherhp
CategoryInfo : OperationStopped: (otherhp:String) [Rename-Computer], InvalidOperationException
FullyQualifiedErrorId : FailToRenameComputer,Microsoft.PowerShell.Commands.RenameComputerCommand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1}
PSMessageDetails :
Run Code Online (Sandbox Code Playgroud)
我在用户办公室没有任何 IT 支持,所以我们尽可能远程进行。如果所有其他方法都失败了,我想我可以授予最终用户足够的权限以取消加入他们的 PC,重命名它,然后重新加入。但如果有现实的替代方案,我真的不想这样做。
收到建议,感激不尽。
我被要求提供NETDOM QUERY /Domain:{domain} WORKSTATION每个 DC的输出。PC 出现在所有三个列表中;这是结果的一个片段:
PS C:\Windows\system32> NETDOM QUERY /Domain:contoso.com /Server:DC1 WORKSTATION
List of workstations with accounts in the domain:
ALPC004 ( Workstation or Server )
...
OTHERHP
...
Run Code Online (Sandbox Code Playgroud)
有问题的个人电脑 ( OTHERPC) 没有该( Workstation or Server )条款 - 但我的许多个人电脑也没有这个条款。
最后我必须做的是解决这个问题:
我注意到我仍然无法重新命名这台电脑(同样的错误),但至少它现在有了正确的名称。
| 归档时间: |
|
| 查看次数: |
5830 次 |
| 最近记录: |