|
| 1 | +--- |
| 2 | +title: Error 0x5 Access Denied When You Rename a Computer in a DC |
| 3 | +description: Helps resolve error 0x5 Access Denied when you rename a computer in a domain controller (DC). |
| 4 | +ms.date: 03/21/2025 |
| 5 | +manager: dcscontentpm |
| 6 | +audience: itpro |
| 7 | +ms.topic: troubleshooting |
| 8 | +ms.reviewer: kaushika, raviks, v-lianna |
| 9 | +ms.custom: |
| 10 | +- sap:active directory\on-premises active directory domain join |
| 11 | +- pcy:WinComm Directory Services |
| 12 | +--- |
| 13 | +# Error 0x5 Access Denied when you rename a computer in a DC |
| 14 | + |
| 15 | +This article helps resolve error 0x5 **Access Denied** when you rename a computer in a domain controller (DC). |
| 16 | + |
| 17 | +When you rename a computer in a Windows Server 2016 DC, you might encounter an **Access Denied** error. |
| 18 | + |
| 19 | +When you check the **NetSetup.log** file, you see the following entries: |
| 20 | + |
| 21 | +```output |
| 22 | +mm/dd/yyyy hh:mm:ss:ms NetpChangeMachineName: from 'TESTNAME97' to 'TESTNAME98' using 'ADATUM.COM\test_adm_user' [0x2] |
| 23 | +mm/dd/yyyy hh:mm:ss:ms NetpDsGetDcName: trying to find DC in domain 'ADATUM', flags: 0x1010 |
| 24 | +mm/dd/yyyy hh:mm:ss:ms NetpDsGetDcName: found DC '\\ADATUMDC01' in the specified domain |
| 25 | +mm/dd/yyyy hh:mm:ss:ms NetpChangeMachineName: status of connecting to dc '\\ADATUMDC01': 0x0 |
| 26 | +mm/dd/yyyy hh:mm:ss:ms NetpGetLsaPrimaryDomain: status: 0x0 |
| 27 | +mm/dd/yyyy hh:mm:ss:ms NetpManageMachineAccountWithSid: status of NetUserSetInfo on '\\ADATUMDC01' for 'TESTNAME97$': 0x5 Access Denied |
| 28 | +``` |
| 29 | + |
| 30 | +`NetUserSetInfo` targets the DC's Security Accounts Manager Server (SAM) server component, which uses the SAM Remote Procedure Call (RPC) function interface based on TCP port 445. Here is the complete TCP connection network traffic during the NetSetup failure event, which indicates the failure at a SAM connection: |
| 31 | + |
| 32 | +```output |
| 33 | +14930 hh:mm:ss hh:mm:ss yyyy/mm/dd 71.2725304 (0) ADATUMDC01 10.101.56.150 TCP TCP: [Bad CheckSum]Flags=...A..S., SrcPort=Microsoft-DS(445), DstPort=59729, PayloadLen=0, Seq=347025249, Ack=2963325843, Win=8192 (Negotiated scale factor 0x8) = 8192 |
| 34 | +14931 hh:mm:ss hh:mm:ss yyyy/mm/dd 71.2731444 (0) 10.101.56.150 ADATUMDC01 TCP TCP:Flags=...A...., SrcPort=59729, DstPort=Microsoft-DS(445), PayloadLen=0, Seq=2963325843, Ack=347025250, Win=256 |
| 35 | +... |
| 36 | +15188 hh:mm:ss hh:mm:ss yyyy/mm/dd 71.6538995 (4) ADATUMDC01 10.101.56.150 MSRPC MSRPC:c/o Fault: Call=0x2 Context=0x0 Status=0x5 Cancels=0x0 0x5 Access Denied |
| 37 | +... |
| 38 | +``` |
| 39 | + |
| 40 | +In addition, you see the following event in the DC SAM server Event Trace Log (ETL): |
| 41 | + |
| 42 | +```output |
| 43 | +[0] 0268.12C0:: yyyy/mm/dd- hh:mm:ss [SAMSRV] security_c3857 SampCheckRpcRemoteCallerAccess() - Remote SAM Access is denied in case1 for the client SID:<SID> from network address: <IP Address> |
| 44 | +``` |
| 45 | + |
| 46 | +## Security policy prevent malicious SAM enumeration |
| 47 | + |
| 48 | +Remote SAM access control was introduced in Windows Server 2016 and Windows 10, version 1607 and later versions as a new security policy to prevent malicious SAM enumeration. Here's the information of the policy: |
| 49 | + |
| 50 | +|Security policy path |Local Security Policy > Security Settings > Local Policies > Security Options | |
| 51 | +|---------|---------| |
| 52 | +|**Policy** |**Network access: Restrict clients allowed to make remote calls to SAM** | |
| 53 | +|**Registry value** |`HKLM\SYSTEM\CurrentControlSet\Control\Lsa\RestrictRemoteSam` | |
| 54 | + |
| 55 | +Only security groups allowed to read for the Remote SAM Remote Procedure Call (RPC) access defined in the policy setting, can set up a SAM connection with the DC. |
| 56 | + |
| 57 | +## Delete the registry value RestrictRemoteSam |
| 58 | + |
| 59 | +In Windows Server 2016 DCs, delete the registry value to apply the default Security Descriptor Definition Language (SDDL). The default value for DCs means that everyone has read permissions to preserve compatibility. To delete the registry value, run the following command: |
| 60 | + |
| 61 | +```console |
| 62 | +reg delete "HKLM\system\currentControlSet\control\lsa" /v restrictRemoteSam /f |
| 63 | +``` |
| 64 | + |
| 65 | +> [!NOTE] |
| 66 | +> This change doesn't require a restart. |
| 67 | +
|
| 68 | +A customized SDDL for the policy might result in unexpected failures. Here are some scenarios to be aware of: |
| 69 | + |
| 70 | +- Admin tools, scripts, and software that previously enumerated users, groups, and group memberships might fail. |
| 71 | +- Remote Desktop Protocol (RDP) connections to Remote Desktop Services (RDS) Servers fail when the RDS tries to retrieve user details using remote SAM RPC calls. |
| 72 | +- Applications that use Authorization (AuthZ) against accounts that are disabled can run into Access Denied errors. For example, Microsoft Exchange Server might encounter this issue during Offline Address Book (OAB) generation checks. |
| 73 | + |
| 74 | + For more information, see [AuthZ fails with an Access Denied error when an application does access checks in Windows Server](../group-policy/authz-fails-access-denied-error-application-access-check.md). |
0 commit comments