AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 814976
Accepted
roaima
roaima
Asked: 2016-11-16 02:54:57 +0800 CST2016-11-16 02:54:57 +0800 CST 2016-11-16 02:54:57 +0800 CST

重命名 AD 计算机成员失败并显示“当该文件已存在时无法创建文件”

  • 772

我正在尝试重命名上周加入我们域的工作站。从那时起,它至少重新启动了一次。

我的域基于 Windows 2012 R2,并且相关成员正在运行 Windows 10 Pro。如果它是有用的信息,我有三个 DC(是的,它们是同步的)。

重命名大部分时间都有效:

$aa = Get-Credential [email protected]
Rename-Computer -ComputerName mynewpc -NewName alpc001 -DomainCredential $aa
WARNING: The changes will take effect after you restart the computer mynewpc.

但是我有几台机器顽固地拒绝允许重命名:

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

这是另一个尝试:

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.

没有具有此新名称的计算机(或其他帐户),并且 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      :

我在用户办公室没有任何 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
...

有问题的 PC ( OTHERPC) 没有该( Workstation or Server )子句 - 但我的许多 PC 也没有这个子句。

powershell active-directory
  • 2 2 个回答
  • 6480 Views

2 个回答

  • Voted
  1. Best Answer
    roaima
    2017-02-03T16:55:50+08:002017-02-03T16:55:50+08:00

    最后我最终不得不做的是解决这个问题:

    1. 远程桌面到 PC 并将其从域中删除
    2. 在重新启动之前,关闭防火墙(或者至少,允许来自非域专用网络的远程 RDP)
    3. 重启
    4. 重命名PC,然后重新启动
    5. 将 PC 重新加入域,然后再次重新启动

    我注意到我仍然无法重命名这台 PC(同样的错误),但至少它现在有了正确的名称。

    • 1
  2. John K. N.
    2016-11-16T05:11:13+08:002016-11-16T05:11:13+08:00

    您的问题是否与 Active Directory 中的旧数据相关联?显然,在降级旧的 Active Directory 服务器时,会留下一些信息。

    如何在域控制器降级不成功后删除 Active Directory 中的数据

    您是否尝试在其中一台 Active Directory 服务器关闭时重命名主机/客户端?然后是另一个 AD 服务器?

    外部信任 - 重复域 SID

    您是否尝试过CMD-Let的-Force参数?Rename-Computer

    • -1

相关问题

  • 资源锁和电源外壳

  • 脚本 - 如何断开远程桌面会话?

  • 如何限制向通讯组发送到外部地址?

  • Powershell对值与数组的作用不同?

  • Windows Powershell Vim 键绑定

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve