Rather than post this in the procedure exchange I thought I would post it here instead, as I found a solution to an issue I have had and seen in the forums but have not seen anyone use the method I came up with to resolve it. it may be out there so apologies if this isn't new to you but it was to me and I thought I should share it. This is my first time posting to the forum.
I was asked to come up with a way to install ScreenConnect for and MSP partner of ours that likes it better then kaseya. The previous persons solution had been to generate an msi for each of there customers upload said Msi and then write a deployment procedure for each one. that seemed like too much work to keep up and maintain, so I went looking at the way ScreenConnect installs. not having ever installed it before or ever worked with it (we are K exclusive for many years)
Anyway the options are similar to the LCOD where you get an exe an msi or a download link.
the link looks like this (with some things redacted)
https://CUSTOMERDOMAIN.screenconnect.com/Bin/ConnectWiseControl.ClientSetup.msi?h=instance-z9nzce-relay.screenconnect.com&p=443&k=(big long key goes here)&e=Access&y=Guest&t=&c=ACME%20test%20z%20enterprise&c=&c=&c=&c=&c=&c=&c=
this link will download the customer coded msi and then installing it is easy. The challenge was to generate the URL. as you can see the customer name is URLEncoded like this ACME%20test%20z%20enterprise, which isnt something native in Kaseya, but can be done using powershell. So my plan put all the pieces of the URL together, then read it back as a whole into kaseya then use GetURL to download the MSI and then run the MSI. Sounds simple, but it was a bit of Rube Goldberg like coding to get it to work.
Step one get the customer Org name so I used GetVariable SQL Data view (SELECT aSOrgs.OrganizationName, vA.Machine_GroupID FROM vComputedDenormalizedOrgToMach aMachOrgs, vSystemOrganizations aSOrgs, vAgentLabel vA where aMachOrgs.OrgId = aSOrgs.id and aMachOrgs.AgentGuid = vA.agentGuid) MyView/OrganizationName
as long as you have your org names set the same you should be fine. note make sure they do not include & or other special characters as this will not get URLencoded. (There is probably a way to do this but it was easier just to change it to "and" instead.)
so there are 4 files in the first part of the process.
merge.ps1 is one line add-content C:\xkworking\scurl.txt -value (get-content c:\xkworking\writeoutput.txt) this is writen to the agent working directorywrieoutput.txt is also a one liner Write-output "$($SitePath)$($uri)$($end)" | Out-File C:\xkworking\scoutput.txtthis one is the beginning of out PS1
we build SCurl.txt using the command WriteTextToFile this is the secret sauce, by appending each line we create a txt file locally that we then rename to our PS1, and then run having sent the variables to the file. This could work in principle with any data saved in Custom fields.
once each part of the URL is crated and merged we then grab the URL back into our procedure and then set the contents to a variable and use that variable in the GetURL command. this downloads the MSI installer with all the settings from ScreenConnect, and we can then use the install msi command to add SC to the box.
Like i said it seems to be a bit elaborate but it works and it also shows a way to send variables to PS1 files from kaseya so let me know your feed back, a simpler way to do this, or if you have used this method before. I have not seen it used that way myself so let me know if i missed it.I attached the procedure and the files. thanks!