Articles in this section

Deploy Via PowerShell Script

FOR INSTALL:

  1. Go to Settings > Account Configuration as shown below and generate a 72-hour link as shown below by clicking on Create next to the operating system installed on your computer.mceclip0.png
  2. Edit Line 2 in PS1 Script that is provided below to have this URL within the Quotes as shown below.image.png
  3. Load script on the machine however you wish (Group Policy, RMM, Remote Powershell, etc.).
  4. Run PS1 script with admin-level permissions. 
  5. A blue dialog box will display with a simple message and close when complete.

---

# Set the URL of the MSI
$AGENT_INSTALLER_URL = "INSERT_URL_HERE"

# ---MODIFY THE BELOW AT YOUR OWN RISK---

# Create a WebRequest to read only headers
$webRequest = [System.Net.HttpWebRequest]::Create($AGENT_INSTALLER_URL)
$webRequest.Method = "HEAD"

# Get the WebResponse
try {
$webResponse = $webRequest.GetResponse()
$contentDispositionHeader = $webResponse.Headers["Content-Disposition"]
$webResponse.Close()
} catch {
Write-Host "Failed to retrieve response headers. $_"
}

if ($contentDispositionHeader) {
# Parse the filename from the Content-Disposition header (your original method)
$filename = $contentDispositionHeader -replace '.*filename=([^;]+).*', '$1'

# Remove any URL encoding from the filename
$filename = [System.Net.WebUtility]::UrlDecode($filename)

# Strip any quotes if present
$filename = $filename.Trim('"')

# Generate timestamp and create temp folder
$TimeStamp = Get-Date -UFormat %s
$agent_installer_path = New-Item -Path "C:\Windows\Temp\" -Name "$TimeStamp" -ItemType "directory"

# Define full path to installer and log
$fullInstallerPath = Join-Path $agent_installer_path.FullName $filename
$LogFilePath = Join-Path $agent_installer_path.FullName "ATInstall.log"

# Download file to that full path
try {
Invoke-WebRequest -Uri $AGENT_INSTALLER_URL -OutFile $fullInstallerPath
} catch {
Write-Host "Download failed. $_"
}

# Run msiexec with correct full file path
try {
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$fullInstallerPath`" /qn /l*v `"$LogFilePath`"" -Wait
} catch {
Write-Host "Installer failed. $_"
}

# Clean up
Remove-Item -Path $fullInstallerPath -Force

Write-Host "Agent installed successfully."
} else {
Write-Host "Content-Disposition header not found. Please contact ActivTrak Support at Support@ActivTrak.com if problem persists."
}

---
FOR DEBUG:
 

C:\Windows\Temp\$Timestamp\atinstall.log is a verbose MSI install log to debug an install, if necessary. This is separated out by install time with a timestamp.

SC QUERY SVCTCOM is the service verification on whether or not it's running.

Was this article helpful?
3 out of 13 found this helpful