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 1 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.

---

//P1 PowerShell script

$AGENT_INSTALLER_URL = "INSERT ACCOUNT CONFIGURATION LINK HERE BETWEEN QUOTATIONS"

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

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

# Get the WebResponse
$webResponse = $webRequest.GetResponse()

# Get the Content-Disposition header
$contentDispositionHeader = $webResponse.Headers["Content-Disposition"]

# Close the response
$webResponse.Close()

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

    # Generating timestamp for the folder name
    $TimeStamp = Get-Date -UFormat %s

    # Creating a temporary folder
    $Folder = New-Item -Path "C:\windows\Temp\" -Name "$TimeStamp" -ItemType "directory"

    # Creating the installer path with the parsed filename
    $AGENT_INSTALLER_PATH = Join-Path $Folder.FullName "$filename"

    # Creating the path for MSIExec verbose log
    $LogFilePath = Join-Path $Folder.FullName "ATInstall.log"

    # Downloading the file
    Invoke-WebRequest -Uri $AGENT_INSTALLER_URL -OutFile $AGENT_INSTALLER_PATH

    # Running the downloaded file silently with verbose logging
    Start-Process -FilePath "msiexec.exe" -ArgumentList "/i $($AGENT_INSTALLER_PATH) /qn /l*v $($LogFilePath)" -Wait

    # Remove the MSI file from the temporary directory
    Remove-Item -Path $AGENT_INSTALLER_PATH -Force
} 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?

2 out of 9 found this helpful

Comments

No comments