다음을 통해 공유


3.2.4.29.5 Update Display Name Using SAMR

This task accepts as input the following:

  • DomainController: the domain controller to perform the update on

  • MachineName: the name of the machine account to update

This task returns no results to the caller. It executes as follows:

  1. The server MUST invoke the SamrConnect5 method on DomainController, specifying the following parameters:

    • DesiredAccess: SAM_SERVER_LOOKUP_DOMAIN | SAM_SERVER_ENUMERATE_DOMAINS

  2. The server MUST invoke the SamrOpenDomain method on DomainController, specifying the following parameters:

    • ServerHandle: The handle obtained in step 1

    • DesiredAccess: DOMAIN_LOOKUP

    • DomainId: DomainSid (section 3.2.1.6)

  3. The server MUST invoke the SamrLookupNamesInDomain method on DomainController, specifying the following parameters:

    • DomainHandle: The handle obtained in step 2

    • Count: 1

    • Names: MachineName

  4. The server MUST invoke the SamrOpenUser method on DomainController, specifying the following parameters:

    • DomainHandle: The handle obtained in step 2

    • DesiredAccess: USER_READ_GENERAL | USER_WRITE_ACCOUNT

    • UserId: The ID of the account obtained in step 3

  5. The server MUST invoke the SamrQueryInformationUser2 method on DomainController, specifying the following parameters:

    • UserHandle: The handle obtained in step 4

    • UserInformationClass: UserAllInformation ([MS-SAMR] section 2.2.6.28)

  6. If the FullName field of the SAMPR_USER_ALL_INFORMATION structure returned in step 5 is equal to MachineName using a case-insensitive comparison, the server MUST continue executing at step 8. Otherwise, execution continues at step 7.

  7. The server MUST invoke the SamrSetInformationUser2 method on DomainController, specifying the following parameters:

    • UserHandle: The handle obtained in step 4

    • UserInformationClass: UserAllInformation ([MS-SAMR] section 2.2.6.28)

    • Buffer: A SAMPR_USER_INFO_BUFFER structure ([MS-SAMR] section 2.2.6.29), with the WhichFields field of the embedded SAMPR_USER_ALL_INFORMATION structure set to USER_ALL_FULLNAME ([MS-SAMR] section 2.2.1.8), and the FullName field of the same structure set to MachineName.

  8. The server MUST invoke SamrCloseHandle on DomainController, specifying the user handle obtained in step 4.

  9. The server MUST invoke SamrCloseHandle on DomainController, specifying the domain handle obtained in step 2.

  10. The server MUST invoke SamrCloseHandle on DomainController, specifying the server handle obtained in step 1.