diff --git a/Agent.Installer.Win/Services/InstallerService.cs b/Agent.Installer.Win/Services/InstallerService.cs index 03c59902..ba1fe219 100644 --- a/Agent.Installer.Win/Services/InstallerService.cs +++ b/Agent.Installer.Win/Services/InstallerService.cs @@ -30,7 +30,8 @@ namespace Remotely.Agent.Installer.Win.Services public async Task Install(string serverUrl, string organizationId, string deviceGroup, - string deviceAlias) + string deviceAlias, + string deviceUuid) { try { @@ -48,7 +49,7 @@ namespace Remotely.Agent.Installer.Win.Services BackupDirectory(); - var connectionInfo = GetConnectionInfo(organizationId, serverUrl); + var connectionInfo = GetConnectionInfo(organizationId, serverUrl, deviceUuid); ClearInstallDirectory(); @@ -262,7 +263,7 @@ namespace Remotely.Agent.Installer.Win.Services ProgressValueChanged?.Invoke(this, 0); } - private ConnectionInfo GetConnectionInfo(string organizationId, string serverUrl) + private ConnectionInfo GetConnectionInfo(string organizationId, string serverUrl, string deviceUuid) { ConnectionInfo connectionInfo; var connectionInfoPath = Path.Combine(InstallPath, "ConnectionInfo.json"); @@ -279,6 +280,10 @@ namespace Remotely.Agent.Installer.Win.Services }; } + if (!string.IsNullOrWhiteSpace(deviceUuid) && Guid.TryParse(deviceUuid, out _)) + { + connectionInfo.DeviceID = deviceUuid; + } connectionInfo.OrganizationID = organizationId; connectionInfo.Host = serverUrl; return connectionInfo; diff --git a/Agent.Installer.Win/ViewModels/MainWindowViewModel.cs b/Agent.Installer.Win/ViewModels/MainWindowViewModel.cs index 986673fc..958fda48 100644 --- a/Agent.Installer.Win/ViewModels/MainWindowViewModel.cs +++ b/Agent.Installer.Win/ViewModels/MainWindowViewModel.cs @@ -36,6 +36,7 @@ namespace Remotely.Agent.Installer.Win.ViewModels { Installer = new InstallerService(); } + public string HeaderMessage { get @@ -161,6 +162,7 @@ namespace Remotely.Agent.Installer.Win.ViewModels private string DeviceAlias { get; set; } private string DeviceGroup { get; set; } + private string DeviceUuid { get; set; } private InstallerService Installer { get; } public async Task Init() { @@ -290,6 +292,11 @@ namespace Remotely.Agent.Installer.Win.ViewModels DeviceAlias = deviceAlias; } + if (CommandLineParser.CommandLineArgs.TryGetValue("deviceuuid", out var deviceUuid)) + { + DeviceUuid = deviceUuid; + } + if (ServerUrl?.EndsWith("/") == true) { ServerUrl = ServerUrl.Substring(0, ServerUrl.LastIndexOf("/")); @@ -312,7 +319,7 @@ namespace Remotely.Agent.Installer.Win.ViewModels HeaderMessage = "Installing Remotely..."; - if (await Installer.Install(ServerUrl, OrganizationID, DeviceGroup, DeviceAlias)) + if (await Installer.Install(ServerUrl, OrganizationID, DeviceGroup, DeviceAlias, DeviceUuid)) { IsServiceInstalled = true; Progress = 0; diff --git a/Server/Pages/Agents.cshtml b/Server/Pages/Agents.cshtml index 9f952a04..924bf163 100644 --- a/Server/Pages/Agents.cshtml +++ b/Server/Pages/Agents.cshtml @@ -76,12 +76,14 @@

Override Options:
- Remotely_Installer.exe -install -quiet + + Remotely_Installer.exe -install -quiet -organization "My Tech Shop" -organizationid "0b3d706b-9c5d-41e6-8ae9-5720d16324e6" -serverurl "https://remotely.mytechshop.com" -devicegroup "Customer Group 1" -devicealias "Front Desk" + -deviceuuid "eebb4d87-5459-4976-989e-a7876dffc69c"