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
+10 -2
View File
@@ -5,6 +5,7 @@ using Disco.Services.Authorization;
using Disco.Services.Documents;
using Disco.Services.Expressions;
using Disco.Services.Interop.ActiveDirectory;
using Disco.Services.Logging;
using Disco.Services.Users;
using System;
using System.Collections.Generic;
@@ -188,8 +189,15 @@ namespace Disco.Services
if (ActiveDirectory.IsValidDomainAccountId(d.DeviceDomainId))
{
var adMachineAccount = ActiveDirectory.RetrieveADMachineAccount(d.DeviceDomainId);
if (adMachineAccount != null)
adMachineAccount.SetDescription(d);
try
{
if (adMachineAccount != null)
adMachineAccount.SetDescription(d);
}
catch (Exception ex)
{
SystemLog.LogWarning($"Unable to update AD Machine Account Description for {d.DeviceDomainId}: {ex.Message}");
}
}
return newDua;