fix #135 avoid failing device import/enrol when unable to set AD description

This commit is contained in:
Gary Sharp
2023-10-12 17:37:42 +11:00
parent 6740a7479a
commit b6945d9bbd
7 changed files with 72 additions and 12 deletions
@@ -2,6 +2,7 @@
using Disco.Models.Repository;
using Disco.Models.Services.Devices.Importing;
using Disco.Services.Interop.ActiveDirectory;
using Disco.Services.Logging;
using System;
using System.Collections.Generic;
using System.Data;
@@ -90,7 +91,15 @@ namespace Disco.Services.Devices.Importing.Fields
if (adAccount != null && !adAccount.IsCriticalSystemObject)
{
adAccount.SetDescription(Device);
try
{
adAccount.SetDescription(Device);
}
catch (Exception ex)
{
SystemLog.LogWarning($"Unable to update AD Machine Account Description for {Device.DeviceDomainId}: {ex.Message}");
throw;
}
DeviceADDescriptionSet = true;
}
}