Jump to content
Pulseway 9.14 🔥

Featured Replies

Posted

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:
PastedGraphic1.thumb.png.57cf7104efe98d6d7624bcfcc59b537e.png

This prevents the script from running correctly, see screenshot below of the error:
PastedGraphic.png.b8423716bb785b176d22c5dfbd3c79ac.png

 

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.

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:

image.thumb.png.cb3a18ec6c57610bf06a989051d7b6ea.pngimage.png.731170d15bc9c1e24d520e9807626389.png

Edited by Brandonn
Photos did not come through

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:

image.png.cf34e42c148428d81ae7d6a39bac77a4.pngimage.png.99e9b297a4b346484385fa8104b463f5.png

Hi.

Can you repost your images I can not see them. 

Thanks,

Richard

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. 

 

 

  • 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. 
image.png.cef30c15bb996133fd9dd7f4224b121a.png

image.png.638a3c9aeb944e38a69ee280ae720fcd.png

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 by Brandonn
Fixed Script

  • 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