#34 Update: Update LastNetworkLogon Dates
Perform UpdateNetworkLongDates task during export if the appropriate field is selected.
This commit is contained in:
@@ -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();
|
var records = BuildRecords(Devices).ToList();
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void UpdateLastNetworkLogonDates(DiscoDataContext Database, ScheduledTaskStatus status)
|
public static void UpdateLastNetworkLogonDates(DiscoDataContext Database, IScheduledTaskBasicStatus status)
|
||||||
{
|
{
|
||||||
var context = ActiveDirectory.Context;
|
var context = ActiveDirectory.Context;
|
||||||
const string ldapFilter = "(objectCategory=Computer)";
|
const string ldapFilter = "(objectCategory=Computer)";
|
||||||
|
|||||||
Reference in New Issue
Block a user