Add deviceuuid as an installer parameter.

This commit is contained in:
Jared Goodwin 2020-03-05 08:18:44 -08:00
parent 5f3b2f64cc
commit de0d2eca25
3 changed files with 19 additions and 5 deletions

View File

@ -30,7 +30,8 @@ namespace Remotely.Agent.Installer.Win.Services
public async Task<bool> 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;

View File

@ -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;

View File

@ -76,12 +76,14 @@
<p>
<strong>Override Options:</strong>
<br />
<span class="label label-default code">Remotely_Installer.exe -install -quiet
<span class="label label-default code">
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"
</span>
</p>
</div>