diff --git a/Disco.BI/BI/DeviceBI/Enrol.cs b/Disco.BI/BI/DeviceBI/Enrol.cs index abfc16ea..1e0ba29a 100644 --- a/Disco.BI/BI/DeviceBI/Enrol.cs +++ b/Disco.BI/BI/DeviceBI/Enrol.cs @@ -481,7 +481,7 @@ namespace Disco.BI.DeviceBI response.DeviceDomainName = MachineInfo.Domain; // Enforce Computer Name Convention - if (RepoDevice.DeviceProfile.EnforceComputerNameConvention) + if (!MachineInfo.IsCriticalSystemObject && RepoDevice.DeviceProfile.EnforceComputerNameConvention) { var calculatedComputerName = RepoDevice.ComputerNameRender(Database); if (!Request.DeviceComputerName.Equals(calculatedComputerName, StringComparison.InvariantCultureIgnoreCase)) @@ -499,7 +499,7 @@ namespace Disco.BI.DeviceBI } // Enforce Organisation Unit - if (response.OfflineDomainJoin == null && RepoDevice.DeviceProfile.EnforceOrganisationalUnit) + if (!MachineInfo.IsCriticalSystemObject && response.OfflineDomainJoin == null && RepoDevice.DeviceProfile.EnforceOrganisationalUnit) { var parentDistinguishedName = MachineInfo.ParentDistinguishedName(); @@ -518,7 +518,7 @@ namespace Disco.BI.DeviceBI } } - if (MachineInfo != null) + if (MachineInfo != null && !MachineInfo.IsCriticalSystemObject) { EnrolmentLog.LogSessionProgress(sessionId, 75, "Updating Active Directory Computer Account Properties"); MachineInfo.UpdateNetbootGUID(Request.DeviceUUID, Request.DeviceLanMacAddress); diff --git a/Disco.BI/BI/Extensions/DeviceActionExtensions.cs b/Disco.BI/BI/Extensions/DeviceActionExtensions.cs index 4884d751..28ab2446 100644 --- a/Disco.BI/BI/Extensions/DeviceActionExtensions.cs +++ b/Disco.BI/BI/Extensions/DeviceActionExtensions.cs @@ -93,7 +93,7 @@ namespace Disco.BI.Extensions if (d.ComputerName != null) { var adAccount = d.ActiveDirectoryAccount(); - if (adAccount != null) + if (adAccount != null && !adAccount.IsCriticalSystemObject) { adAccount.DisableAccount(); } @@ -120,7 +120,7 @@ namespace Disco.BI.Extensions if (d.ComputerName != null) { var adAccount = d.ActiveDirectoryAccount(); - if (adAccount != null) + if (adAccount != null && !adAccount.IsCriticalSystemObject) { adAccount.EnableAccount(); } diff --git a/Disco.Client/Interop/Network.cs b/Disco.Client/Interop/Network.cs index 3fe92e6c..6ddea1ba 100644 --- a/Disco.Client/Interop/Network.cs +++ b/Disco.Client/Interop/Network.cs @@ -21,7 +21,15 @@ namespace Disco.Client.Interop if (NetworkAdapters.Count > 0) { // Only Retrieve Wlan Adapters if at least one adapter was found by WMI - RetrieveWlanAdapters(); + try + { + RetrieveWlanAdapters(); + } + catch (DllNotFoundException) + { + // Ignore DllNotFoundException + // This which indicates 'Wlanapi.dll' isn't present (eg. Windows Servers) + } // Determine Primary Adapters