function Get-RemoteFileBeatsPath { <# .SYNOPSIS Get the installed folder path of filebeat for a given server. .PARAMETER ComputerName Server to get the path from #> [CmdletBinding()] Param( [Alias("Server")] [string]$ComputerName ) if (!$ComputerName) { Write-Error "No remote computer name was provided. Did you mean to call Get-FileBeatsPath?" } else { $scriptBlock = { Get-FileBeatsPath } return Invoke-Command -ScriptBlock $scriptBlock -ComputerName $ComputerName } }