Disco.Services.Interop.ActiveDirectory.ADDomainController.RetrieveADMachineAccount C# (CSharp) Method

RetrieveADMachineAccount() public method

public RetrieveADMachineAccount ( string Id, System UUIDNetbootGUID, System MacAddressNetbootGUID, string AdditionalProperties = null ) : ADMachineAccount
Id string
UUIDNetbootGUID System
MacAddressNetbootGUID System
AdditionalProperties string
return ADMachineAccount
        public ADMachineAccount RetrieveADMachineAccount(string Id, System.Guid? UUIDNetbootGUID, System.Guid? MacAddressNetbootGUID, string[] AdditionalProperties = null)
        {
            if (string.IsNullOrWhiteSpace(Id))
                throw new ArgumentNullException("Id");

            // Add $ identifier for machine accounts
            if (!Id.EndsWith("$"))
                Id += "$";

            string[] loadProperites = (AdditionalProperties != null && AdditionalProperties.Length > 0)
                ? ADMachineAccount.LoadProperties.Concat(AdditionalProperties).ToArray()
                : ADMachineAccount.LoadProperties;

            ADSearchResult adResult;

            adResult = RetrieveBySamAccountName(Id, ADMachineAccount.LdapSamAccountNameFilterTemplate, loadProperites);
            if (adResult == null && (UUIDNetbootGUID.HasValue || MacAddressNetbootGUID.HasValue))
            {
                string ldapFilter;
                if (UUIDNetbootGUID.HasValue && MacAddressNetbootGUID.HasValue)
                {
                    ldapFilter = string.Format(ADMachineAccount.LdapNetbootGuidDoubleFilterTemplate, UUIDNetbootGUID.Value.ToLdapQueryFormat(), MacAddressNetbootGUID.Value.ToLdapQueryFormat());
                }
                else if (UUIDNetbootGUID.HasValue)
                {
                    ldapFilter = string.Format(ADMachineAccount.LdapNetbootGuidSingleFilterTemplate, UUIDNetbootGUID.Value.ToLdapQueryFormat());
                }
                else // MacAddressNetbootGUID.HasValue
                {
                    ldapFilter = string.Format(ADMachineAccount.LdapNetbootGuidSingleFilterTemplate, MacAddressNetbootGUID.Value.ToLdapQueryFormat());
                }
                adResult = this.SearchEntireDomain(ldapFilter, loadProperites, ActiveDirectory.SingleSearchResult).FirstOrDefault();
            }

            if (adResult != null)
                return adResult.AsADMachineAccount(AdditionalProperties);
            else
                return null; // Not Found
        }
        public ADMachineAccount RetrieveADMachineAccount(string Id, string[] AdditionalProperties = null)

Same methods

ADDomainController::RetrieveADMachineAccount ( string Id, System NetbootGUID, string AdditionalProperties = null ) : ADMachineAccount
ADDomainController::RetrieveADMachineAccount ( string Id, string AdditionalProperties = null ) : ADMachineAccount