Assigning a Device to a Group with Install-AxAgentMSI.ps1
When using the Install-AxAgentMSI.ps1 script from the Automox Agent Installation Overview, you can assign a device to a specific group or parent group. Follow the instructions below for proper usage.
Usage Example
Run the script with at least an AccessKey specified:
Install-AxAgentMsi.ps1 -AccessKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Optionally, include a GroupName and ParentGroupName as needed:
Install-AxAgentMsi.ps1 -AccessKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -GroupName "My Group Name" -ParentGroupName "My Parent Group Name"
Important Notes
-
Parent Group Assignment:
- If the parent group is also a child member of another group, do not include the parent’s parent group in the assignment.
Incorrect Example:
Install-AxAgentMsi.ps1 -AccessKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -GroupName "My Group Name" -ParentGroupName "My Parent's Parent Group Name/My Parent Group Name"
Correct Example:
Install-AxAgentMsi.ps1 -AccessKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -GroupName "My Group Name" -ParentGroupName "My Parent Group Name"
-
Default Group Handling:
- If the Parent Group is the Default Group, there’s no need to declare it. The script automatically accounts for this scenario.
Script
The script uses the following function to assign groups:
function Set-AxServerGroup {
param (
[Parameter(Mandatory = $true)][String]$Group,
[Parameter(Mandatory = $false)][String]$ParentGroup
)
if ($ParentGroup) {
$argList = "--setgrp `"Default Group/$ParentGroup/$Group`""
} else {
$argList = "--setgrp `"Default Group/$Group`""
}
Start-Process -FilePath $agentPath -ArgumentList "$argList" -Wait
Start-Process -FilePath $agentPath -ArgumentList "--deregister"
}
- The function assigns the group and, if needed, references the parent group directly under the Default Group.
Example of Proper Usage
Assigning a device to a group under the default parent group:
Install-AxAgentMsi.ps1 -AccessKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -GroupName "My Group Name"
Assigning a device to a group with a specified parent group:
Install-AxAgentMsi.ps1 -AccessKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -GroupName "My Group Name" -ParentGroupName "My Parent Group Name"
Prerequisites
- Ensure PowerShell version 5.1 or higher is installed.
- Verify administrative privileges on the target device.
- Confirm the path to the Automox agent is correctly configured.
Troubleshooting
- Invalid Group Names: Ensure the group names match those configured in the Automox dashboard.
- Script Errors: Verify the AccessKey and agent path are correctly specified.
- For additional support, refer to the Automox Agent Installation Overview.