ps/Modules/Alkami.DevOps.Common/Public/Get-AutomoxAgentPath.ps1
2023-05-30 22:51:22 -07:00

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
}