25 lines
662 B
PowerShell
25 lines
662 B
PowerShell
function Get-AutomoxAgentPath {
|
|
|
|
<#
|
|
.SYNOPSIS
|
|
Returns the full path and filename of the Automox Agent executable
|
|
|
|
.DESCRIPTION
|
|
Searches Program Files and Program Files x86 for amagent.exe. Returns the full path and filename
|
|
#>
|
|
|
|
[CmdletBinding()]
|
|
param()
|
|
|
|
$logLead = (Get-LogLeadName)
|
|
|
|
$automoxAgentDirectory = Get-ChildItem -File -Recurse -Depth 2 -Path @(${env:ProgramFiles(x86)}, $ENV:ProgramFiles) -Filter amagent.exe | Select-Object -First 1
|
|
|
|
if ($null -eq $automoxAgentDirectory) {
|
|
|
|
Write-Warning "$logLead : Unable to Locate the Automox Agent Executable"
|
|
return $null
|
|
}
|
|
|
|
return $automoxAgentDirectory.FullName
|
|
} |