Question

How to actually change groups from the commandline?

  • 21 June 2024
  • 2 replies
  • 26 views

Badge

I’ve tried multiple ways to change groups a device is in from the commandline on the device, all unsuccessfully.

I’ve tried the suggestions from https://help.automox.com/hc/en-us/articles/5384338960020-Deploying-the-Automox-Agent-in-Bulk, and installing with the MSI options to add to a group are ignored - it always ends up in the Default Group only.

This command will only install it to the Default Group, ignoring the child group:

Start-Process 'msiexec.exe' -ArgumentList '/i "Automox_Installer-latest.msi" /qn /norestart ACCESSKEY=<key> GROUP="Default Group/Dev Group 1"'


The PowerShell script just fails silently to even install at all when I run it, using the command as an administrator, although the same is true when run from Windows PowerShell ISE interactively.
.\Install-AXAgentMSI.ps1 -AccessKey <key> -GroupName "Dev Group 1"


https://github.com/AutomoxCommunity/se-utilities-public/blob/main/Scripts/Install-AXAgentMSI.ps1

 

On Linux it’s even worse - the options to move to different groups do nothing every time but produce no output whatsovever except for deregistering the agent.

 

Is there any way to see output of the commands so I can verify the agent is being moved from the device itself?  Are there any proven methods to install the agent to a group directly on both Windows and Linux? 

 

How can the agent be installed on Linux and Windows without needing to manually move it to the correct group in the console every single time?


2 replies

Userlevel 1

Hey lgaudreau,

 

Sorry to hear you’re having some issues assigning a device to a Group! I copy and pasted your Start-Process command and was able to get this to work successfully on my side. My code looks like this:

Start-Process 'msiexec.exe' -ArgumentList '/i "Automox_Installer-latest.msi" /qn /norestart ACCESSKEY=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx GROUP="Default Group/KGregg_Devices/Webinar Test"'

 

As per the PS1 deployer, modifying the code in the KB to match my Groups works as well with this configuration:

.\Install-AxAgentMsi.ps1 -AccessKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -GroupName "KGregg_Devices" -ParentGroupName "Webinar Test"

For Linux, this is similar:

amagent --setgrp 'Default Group/KGregg_Devices/Webinar Test'

 

You mentioned in your question that the Group you’re trying to target is a Child Group. If your Group is a child of another Group, you will need to specify that Group as well. For example, if “Dev Group 1” is in a Group called “Dev Group” your code should look like this:
 

GROUP="Default Group/Dev Group/Dev Group 1"

The fact that the agent can be installed even though it goes into a Default Group tells me that the agent can communicate with your Console properly, so it appears here there may be an issue with the way the Groups are specified.

 

If you have any further issues, remember you can always submit a ticket to help.automox.com for support!

Badge

Hi Kyle,

Thanks for your reply. 

When I said ‘child group’, I meant child of the ‘Default Group’.

I ran some new tests but this time I used a different group and it worked - it looks like the group I was using to test with had an extra space in it, which was hard to notice in the console and but of course made the command line options fail. 

Glad for your confirmation that it is working!  Next time I’ll try with different groups or groups I’ve created if needed.

Thanks,


Lincoln

 

Reply