diff --git a/Disco.Services/Devices/Exporting/DeviceExport.cs b/Disco.Services/Devices/Exporting/DeviceExport.cs index e33b6183..89d29076 100644 --- a/Disco.Services/Devices/Exporting/DeviceExport.cs +++ b/Disco.Services/Devices/Exporting/DeviceExport.cs @@ -43,7 +43,19 @@ namespace Disco.Services.Devices.Exporting }); } - TaskStatus.UpdateStatus(40, "Extracting records from the database"); + // Update Last Network Logon Date + if (Options.DeviceLastNetworkLogon) + { + TaskStatus.UpdateStatus(40, "Updating device last network logon dates"); + try + { + Interop.ActiveDirectory.ADTaskUpdateNetworkLogonDates.UpdateLastNetworkLogonDates(Database, ScheduledTaskMockStatus.Create()); + Database.SaveChanges(); + } + catch (Exception) { } // Ignore Errors + } + + TaskStatus.UpdateStatus(60, "Extracting records from the database"); var records = BuildRecords(Devices).ToList(); diff --git a/Disco.Services/Interop/ActiveDirectory/ADTaskUpdateNetworkLogonDates.cs b/Disco.Services/Interop/ActiveDirectory/ADTaskUpdateNetworkLogonDates.cs index e96602b5..cb407b63 100644 --- a/Disco.Services/Interop/ActiveDirectory/ADTaskUpdateNetworkLogonDates.cs +++ b/Disco.Services/Interop/ActiveDirectory/ADTaskUpdateNetworkLogonDates.cs @@ -114,7 +114,7 @@ namespace Disco.Services.Interop.ActiveDirectory return false; } - private static void UpdateLastNetworkLogonDates(DiscoDataContext Database, ScheduledTaskStatus status) + public static void UpdateLastNetworkLogonDates(DiscoDataContext Database, IScheduledTaskBasicStatus status) { var context = ActiveDirectory.Context; const string ldapFilter = "(objectCategory=Computer)";