Posted April 19, 20231 yr Up until the most recent update to Pulseway, I was able to install the Huntress agent via their provided Powershell script at: https://github.com/huntresslabs/deployment-scripts/blob/main/Powershell/InstallHuntress.powershellv2.ps1 This script includes the "param" command, which has to be the first line of the script in order to run. After the recent update to Pulseway, all scripts that are run add an $ENV_AgentTemp variable to the top of the script, see screenshot below: This prevents the script from running correctly, see screenshot below of the error:  Please note that the powershell output shows the error on line 32, whereas in the script it is on line 31, which is what led me on the path to find that the extra line was being added at the top of the script by Pulseway. Is there a way to prevent that first line from being added to the script, or do I need to contact Huntress and have them rework a different version of the script that doesn't include the "param" command? Cheers.
April 21, 20231 yr You are using parameters outside of a function. Parameters can only be defined inside of a function, otherwise you are essentially trying to run the 'param' command. For example: Edited May 2, 20231 yr by Brandonn Photos did not come through
April 25, 20231 yr On 4/22/2023 at 12:57 AM, Brandonn said: You are using parameters outside of a function. Parameters can only be defined inside of a function, otherwise you are essentially trying to run the 'param' command. For example: Hi. Can you repost your images I can not see them. Thanks, Richard
April 25, 20231 yr I have the same issue, I have found the script works fine deployed via Pulseway on Windows 10 but fails on Windows 11. The script works fine when run locally in PowerShell on both OS.  Â
April 26, 20231 yr Author Hi Richard, The screenshots are below. Please let me know if you have issues with it showing. This is happening with both Windows 10 and 11 devices.Â
May 2, 20231 yr On 4/25/2023 at 11:12 AM, Richard Davis said: Hi. Can you repost your images I can not see them. Thanks, Richard They should be there now. Maybe wrap the huntress install script in a function that passes all the relevant information? I did some more testing, and you can include the arguments if you are just running the script normally, but since you cannot include additional arguments when running the script through Pulseway, they will have to be manually added to the script. I believe this would work. function Install-Huntress { param ( [string]$acctkey, [string]$orgkey, [string]$tags, [switch]$reregister, [switch]$reinstall, [switch]$uninstall, [switch]$repair ) # Rest of the code return "$acctkey - $orgkey - $tags - $reregister - $reinstall - $uninstall - $repair" } Install-Huntress -acctkey 1234 -orgkey 5678 -tags "tag1" -reregister $true -uninstall $false -repair $false  Edited May 2, 20231 yr by Brandonn Fixed Script
May 10, 20231 yr Author Thanks for your help, Brandonn. This has resolved the issue. I have been in touch with Huntress support and they are creating a Pulseway-specific installer script using the solution you provided above. Cheers.
Create an account or sign in to comment