Fix #141 preserve computer names for non-domain joined devices

This commit is contained in:
Gary Sharp
2024-01-11 16:27:40 +11:00
parent 974a07f3bb
commit 85d51c0e45
6 changed files with 44 additions and 33 deletions
@@ -35,7 +35,10 @@ namespace Disco.Services.Devices.Importing.Fields
try
{
parsedValue = ActiveDirectory.ParseDomainAccountId(parsedValue);
if (ActiveDirectory.IsValidDomainAccountId(parsedValue, out var accountUsername, out var accountDomain))
parsedValue = $@"{accountDomain.NetBiosName}\{accountUsername}";
else
return Error(@"The expected format is 'DOMAIN\ComputerName'");
}
catch (ArgumentException ex) when (ex.ParamName == "NetBiosName")
{