Command Line install

I’ve got an antivirus installed on all my customer’s PCs and it has the ability to run a command line from the System account for any asset listed in my AV dashboard. I’d like to be able to install Syncro on my managed PCs using this method. I’ve played around with various ways using a call to Powershell, but it keeps failing. Using something like this is what Huntress had me use and it worked to install Huntress using the command prompt:

powershell “(New-Object Net.WebClient).DownloadFile(‘https://huntress.io/download/xyz’,"$env:temp/HuntressInstaller.exe");”%TEMP%\HuntressInstaller.exe /S /ACCT_KEY=xyz /ORG_KEY=“xxx”

But when I put in Syncro pieces, it fails.

powershell “(New-Object Net.WebClient).DownloadFile(‘https://rmm.syncromsp.com/dl/rs/mysyncroinformationkey’,"$env:temp/syncro-installer.exe");”%TEMP%\syncro-installer.exe --console

I’d appreciate some help. Thanks!

Do this:

powershell -command "(New-Object System.Net.WebClient).DownloadFile('YOURSYNCROURL', '%temp%/syncro.exe')";"%temp%/syncro.exe"

Also you have your ; inside your quote at the end, but it should be outside the quote.

Thank you. I ran this through an elevated command prompt to test and this was the result:

image

Thoughts on why this is failing? Thank you.

1 Like

SSL/TLS issue. Try forcing TLS for PS/.NET

Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord

Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord

Yup you can do the above, or if you’re just looking for a one liner because that’s all you can run through your AV, you can modify what I gave you to be this, and this should do the trick.


powershell -command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12,Tls11,Tls; (New-Object System.Net.WebClient).DownloadFile('YOURSYNCROURL', '%temp%/syncro.exe')";"%temp%/syncro.exe"

Since this is a one liner, I used @mgiordano solution. Still has some errors, but fewer:

image

What I provided works each time I run it, that error looks like you maybe copy/pasted and it formatted it incorrectly. The single quotes look, messed up lol. I’ve seen that happen before.

Let’s break this down into a smaller piece. I just issued this single command and received this error, which is the same as the one in my previous post.

powershell -command “[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12,Tls11,Tls”

I did some googling and found that this is what I can use and it received no errors:

powershell -command “[Net.ServicePointManager]::SecurityProtocol = ‘Tls12,Tls11,Tls’”

So I continued to test and issued the DownloadFile command which received an error.

Can anyone help with this next step? Thanks.

Sorry, bit hard to see in your screenshot, but it looks like you’ve wrapped that entire second part in ( ) which you shouldn’t need. If you look back at mine, this part specifically, the ending ) comes after you tell it where to download the file to, then end quote, then ; then quotes and call the install.

DownloadFile('YOURSYNCROURL', '%temp%/syncro.exe')";"%temp%/syncro.exe"

EDIT - Sorry I’m dumb, it wrapped and I realize now you removed the part where you’re calling the install. so ignore my bit above lol

Sorry on the road here so was looking at this on my phone. If someone doesn’t chime in before I’m back, I’ll take another look later.

I always use invoke-webrequest, but it does require PS2+ I believe, so outdated Win7 can’t do it. I used this method when we had CWC and switched to Syncro.

powershell.exe -c "Invoke-WebRequest -Uri http://server.domain.tld/path/to/file.ext -OutFile C:\path\to\save\download\file.ext"

Here is what finally worked for me. It is a single line Command Prompt that calls PowerShell to first allow the security protocol that is necessary for downloading, then download the installer and execute it.

powershell “[Net.ServicePointManager]::SecurityProtocol = ‘Tls12,Tls11,Tls’ ; (New-Object Net.WebClient).DownloadFile(‘https://rmm.syncromsp.com/dl/rs/MYSYNCROKEY’,"$env:temp/syncro.exe");”%TEMP%\syncro.exe --console"

Thanks to all who helped.

I’ve noticed that when the forum “formatter” took my posted code, it removed some things that NEED to be there for it to work. Here is a screenshot of the Command Prompt call to PowerShell the way it should be.

For some reason, the formatter is taking the backslashes out and they NEED to be there. I see now that they were supposed to be in the original Huntress code that was OP, but the formatter removed them there as well.

Why not just use a simple msiexe command? Have your syncro msi file hosted and voila

@anon93541942 Thanks for the thought, but this is all a mute point, now, since the above worked and I have Syncro on all PCs. But from your example, host the file how? And what command line would you use, in an example? Remember, I don’t have remote access to these customer sites unless a customer gets me on remotely. If you are saying I should download the installer to a locally shared location and install that way, I would need to interact with a lot of customers taking a lot of time and causing a lot more interruption. Thus a one line CMD works perfectly being executed through the AV with no customer interaction.

oh man I am sorry for the late reply…
So I upload all my .msi to a webserver I have…
the command looks like this
msiexec /i https://syncro.yourdomain.com/admin/SyncroCLIENT.msi CMDLINE=SME,quiet /qn