Skip to main content

Device Status Shows Disconnected, but user is active Logged In.
Any Idea why this is showing as Disconnected?

 

Hello ​@Mohan,

If a device appears disconnected in the console but is powered on, the most likely cause is the agent being turned off. You may need to restart the service from task manager or you can reference Agent Command Line Guide for instructions for your OS.

 

Automox shows that my device is disconnected when I'm logged in

 

 

 


Any idea why the agent being turned off when the device is active and user working on it.

Is it normal behavior of the Automox agent? 


We’re also experiencing this on a frequent basis.


@Mohan ​@bachtenberg

This is not expected behavior. Please reach out to our support team to triage the repeated issue you’re encountering. 


@Mohan ​@bachtenberg

This is not expected behavior. Please reach out to our support team to triage the repeated issue you’re encountering. 

Opened a ticket - Currently I have an intune remediation script that runs to resolve this

For anyone who might come across this in the future - This is my detection script

# Detect-amagent.ps1
$serviceName = 'amagent'

$svc = Get-Service -Name $serviceName -ErrorAction SilentlyContinue
if (-not $svc) {
Write-Output "$serviceName not installed. Skipping remediation."
exit 0 # Treat as compliant if agent isn't installed
}

if ($svc.Status -eq 'Running') {
Write-Output "$serviceName is running."
exit 0
} else {
Write-Output "$serviceName is $($svc.Status). Remediation required."
exit 1
}

This is my remediation script

 

# Remediate-amagent.ps1
$serviceName = 'amagent'
$maxWaitSeconds = 30

$svc = Get-Service -Name $serviceName -ErrorAction SilentlyContinue
if (-not $svc) {
Write-Output "$serviceName not installed. Nothing to remediate."
exit 0
}

# If someone set it to Disabled, flip to Manual so we can start it
try {
if ($svc.StartType -eq 'Disabled') {
Write-Output "$serviceName is Disabled. Setting StartupType to Manual."
Set-Service -Name $serviceName -StartupType Manual
}
} catch {
Write-Warning "Failed to change StartupType: $($_.Exception.Message)"
}

if ($svc.Status -ne 'Running') {
try {
Start-Service -Name $serviceName -ErrorAction Stop
} catch {
Write-Warning "Start-Service failed: $($_.Exception.Message). Retrying via sc.exe..."
sc.exe start $serviceName | Out-Null
}

# Wait until Running or timeout
$deadline = (Get-Date).AddSeconds($maxWaitSeconds)
do {
Start-Sleep -Seconds 1
try { $svc = Get-Service -Name $serviceName -ErrorAction Stop } catch { break }
} while ($svc.Status -ne 'Running' -and (Get-Date) -lt $deadline)

if ($svc.Status -ne 'Running') {
Write-Error "$serviceName failed to start (status: $($svc.Status))."
exit 1
}
}

Write-Output "$serviceName is running."
exit 0