Adding PC to JumpCloud from Atera

If you're like me, you have a thumbdrive that you keep with you that has most of your scripts for setting up a computer or utilities that need to get installed. After running out of space on my thumbdrive and wanting other people in the company to be able to do things as easily as I have been, I have started loading my script toolbox into Atera so that anyone can run these against systems to get them from the box to the client faster.

One of the first things I always have to do is load JumpCloud onto the machine if the client is using it. JumpCloud 0.10.74 was the latest version as of this post, so that's what we're installing:

###
# Date: 2019-08-28
# Author: Dave Long <dlong@cagedata.com>
#
# Downloads and installs the JumpCloud agent.
###
$JumpCloudURI = "https://s3.amazonaws.com/jumpcloud-windows-agent/production/versions/0.10.74/JumpCloudInstaller.exe"

$File = Join-Path -Path $env:TEMP -ChildPath "JumpCloudInstaller.exe"
$ConnectKey = "{[ConnectKey]}"

Invoke-WebRequest -Uri $JumpCloudURI -OutFile $File

$Params = @{
  "FilePath" = "$File"
  "ArgumentList" = @(
    "-k $ConnectKey"
    "/norestart"
    "/verysilent"
  )
  "Verb" = "runas"
  "PassThru" = $true
}

$Installer = start-process @Params
$Installer.WaitForExit()