From d8fc45ee6f804cce642455ce1d0631b3a1792d7a Mon Sep 17 00:00:00 2001 From: Gary Sharp Date: Thu, 31 Oct 2013 14:15:00 +1100 Subject: [PATCH] Feature #3: Server SKU support for Enrolment The Disco Client (which is launched by the Bootstrapper) supports Windows Server SKUs. Removes dependancy on WLANAPI.DLL. Updates to enrolment allows for successful addition to System Critial objects (eg. DC/PDCs) into Disco without making any changes to AD objects. --- Disco.BI/BI/DeviceBI/Enrol.cs | 6 +++--- Disco.BI/BI/Extensions/DeviceActionExtensions.cs | 4 ++-- Disco.Client/Interop/Network.cs | 10 +++++++++- 3 files changed, 14 insertions(+), 6 deletions(-) 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