Prerequisites
- Ensure that you have reviewed and understand the Install Token and Agent ID Values
https://support.getquickpass.com/hc/en-us/articles/360061942274-Export-Customers-List-Status-and-Agent-ID-s - Run the Powershell Command as Administrator
- Review the Scripted Agent Installation KB Article to understand what each Powershell Parameter will do
https://support.getquickpass.com/hc/en-us/articles/4413576799639-Scripted-Agent-Installation - This process can be utilized via your RMM solution. For deploying through your RMM solution please take a look at this KB
https://support.getquickpass.com/hc/en-us/sections/8400847538967-Agent-Deployment-Automation or consult your vendor's documentation on how to push software remotely through their RMM agent.
How to Edit and Execute script
- Run PowerShell ISE AS ADMINISTRATOR
- Click the New Script icon (Paper with Asterisks in top right corner)
- Paste the script below into the Text area prior to modification.
- You will want to modify lines 12 & 13 ($QPInstallTokenID = "InstallToken" & $QPAgentID = "AgentID") to include the static Tenant Install Token and the individual Customer's Agent ID.
- Please ensure to leave the open and closing quotes around those values.
- You will want to modify lines 12 & 13 ($QPInstallTokenID = "InstallToken" & $QPAgentID = "AgentID") to include the static Tenant Install Token and the individual Customer's Agent ID.
- Once Editing has been completed, run the script by clicking the "Play" button or press F5 on your keyboard.
NOTE: If you want to run the PowerShell script from command line and pass the variables as arguments, skip to PowerShell Script With Arguments
PowerShell Script
##Quickpass Installation PowerShell Script
$Path = "C:\QPInstall"
$DownloadURL = "https://storage.googleapis.com/qp-installer/production/Quickpass-Agent-Setup.exe"
$Output = $path + "\Quickpass-Agent-Setup.exe"
#Edit These Values for your Install Token and Agent ID Inside quotation Marks
$QPInstallTokenID = "InstallToken"
$QPAgentID = "CustomerAgentID"
#Edit RegionID for EU Tenant ONLY
#RegionID = "EU" for EU Tenant
#RegionID = "NA" for North America/Oceania Tenant
$RegionID = "NA"
#adds quotes to Installation Parameter
$QPInstallTokenIDBLQt = """$QPInstallTokenID"""
$QPAgentIDDBlQt = """$QPAgentID"""
$Region = """$RegionID"""
#Restart Options
<#Restart Commands
.NET lower than 4.7.2
.NET 4.7.2 or Higher Already Installed
No value Specified
After installation of .NET completes the system will automatically be restarted & After admin login, installation of the Agent system will complete and system will NOT be rebooted
After installation of the Agent system will NOT be rebooted
/NORESTART
After installation of .NET completes the system will NOT automatically be restarted & After admin login, installation of the Agent will complete and system will NOT be rebooted
After installation of the Agent system will NOT be rebooted
/FORCERESTART
After installation of .NET completes the system will automatically be restarted & After admin login, installation of the Agent will complete and system will NOT be rebooted
After installation of the Agent system will NOT be rebooted
RESTART=1
After installation of .NET completes the system will automatically be restarted & After admin login, installation of the Agent will complete and system will be rebooted
After installation of the Agent system will be rebooted
#>
$RestartOption = "/NORESTART"
#MSA vs Local System Service Options
<#MSA Commands
No Value Specified
The Agent will use the Local System Account to run the service
MSA=0
The Agent will use the Local System Account to run the service
MSA=1
A Managed Service Account will be created to run the Service
NOTE: This is only used for Domain Controllers. All other system types this command will be ignored.
#>
$MSAOption = "MSA=1"
# Get the .NET version
$VersionKey = "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\"
$NetVersion = (Get-ItemProperty -Path $VersionKey).Version
#Test if download destination folder exists, create folder if required
If(Test-Path $Path)
{write-host "Destination folder exists"}else{
#Create Directory to download quickpass installer into
write-host "Creating folder $Path"
md $Path
}
#Begin download of Quickpass Agent
write-host "Beginning download of the quickpass agent"
Invoke-WebRequest -Uri $DownloadURL -OutFile $Output -UseBasicParsing
#Write Variables and Notifications
write-host "Variables in use for Quickpass Agent installation"
write-host "Software Path: $Output"
write-host "Installation Token: $QPInstallTokenID"
write-host "Customer ID $QPAgentID"
write-host "Restart option Selected $RestartOption"
write-host "MSA Creation Selected $MSAOption"
# Kill processes with Installation or update of CyberQP
Get-Process | Where-Object { $_.ProcessName -like "*quickpass-agent*" } | ForEach-Object { Stop-Process -Id $_.Id -Force }
Get-Process | Where-Object { $_.ProcessName -like "*qpupdate*" } | ForEach-Object { Stop-Process -Id $_.Id -Force }
# Kill all existing processes running msiexec.exe
Get-Process | Where-Object { $_.ProcessName -eq "msiexec" } | ForEach-Object { Stop-Process -Id $_.Id -Force }
write-host "Beginning installation of Quickpass"
#Run QP Agent download file
Try
{
Start-Process "$Output" -ArgumentList "/quiet $RestartOption INSTALLTOKEN=$QPInstallTokenIDBLQt CUSTOMERID=$QPAgentIDDBlQt REGION=$Region $MSAOption" -ErrorAction Stop
}
Catch
{
$ErrorMessage = $_.Exception.Message
write-host "Install error was: $ErrorMessage"
#exit 1
}
# Compare the .NET version with 4.7.2
if ([version]$NetVersion -lt [version]"4.7.2") {
# Display a message in Blue with Yellow Background
Write-Host "`n.NET version $NetVersion detected. The system will need a reboot to complete phase 1, at which time the installation will automatically continue." -ForegroundColor Blue -BackgroundColor Yellow
return
}
#Check if service is running
$serviceName = "Quickpass Server Agent"
$maxAttempts = 3
Start-Sleep -Seconds 20 # Wait for 20 seconds
$serviceStatus = Get-Service -Name $serviceName
for ($attempt = 1; $attempt -le $maxAttempts; $attempt++) {
if ($serviceStatus.Status -eq "Running") {
Write-Host "The service '$serviceName' is now running. Quickpass Agent should have been installed successfully"
break
}
elseif ($attempt -eq $maxAttempts) {
Write-Host "Service '$serviceName' failed to start. Confirm the variables 'QPInstallTokenID' and 'QPAgentID' are defined and try again, or check the error logs."
break
}
else {
Write-Host "Waiting for service '$serviceName' to start..."
Start-Sleep -Seconds 30
$serviceStatus = Get-Service -Name $serviceName
}
}
PowerShell Script With Arguments
To run the PowerShell script from command line and pass the variables as arguments, please use this PowerShell script.
How to Edit and Execute script
- Run PowerShell ISE AS ADMINISTRATOR
- Click the New Script icon (Paper with Asterisks in top right corner)
- Paste the script below into the Text area
- Save the file to the desired directory, i.e. C:\AgentInstallScripts or root C:\
- Click the New Script icon (Paper with Asterisks in top right corner)
- In the text area, enter the following (NOTE: Edit the path that the 'cd' command goes to depending on where you saved the PowerShell script in step #3.1):
-
cd C:\ ; .\QPInstall.ps1 '<installtoken>' '<agentid>'
#edit 'cd C:\' path according to the location of the QPInstall.ps1 PowerShell script - Modify the <installtoken> and <agentid> to include the static Tenant Install Token and the individual Customer's Agent ID
- Please ensure to leave the open and closing single-quotes around those values
- If your QP Tenant is based in EU, add the parameter '-EU' to the end as shown below
-
cd C:\ ; .\QPInstall.ps1 '<installtoken>' '<agentid>' -EU
#edit 'cd C:\' path according to the location of the QPInstall.ps1 PowerShell script
-
-
- Once editing has been completed, run the script by clicking the "Play" button or press F5 on your keyboard.
NOTE: If you wish to modify the $RestartOption and $MSAOption variables you may add additional arguments to the PowerShell script, then include those argument values to the command line script accordingly.
##Quickpass Installation PowerShell Script
Param(
[switch]$EU
)
$Path = "C:\QPInstall"
$DownloadURL = "https://storage.googleapis.com/qp-installer/production/Quickpass-Agent-Setup.exe"
$Output = $path + "\Quickpass-Agent-Setup.exe"
#Arguments to declare Install Token and Agent ID at run-time
$QPInstallTokenID = $args[0]
$QPAgentID = $args[1]
#Call for -EU parameter at run-time if EU tenant deploy
If ($EU) {
$RegionID = "EU"
} else {
$RegionID = "NA"
}
#adds quotes to Installation Parameter
$QPInstallTokenIDBLQt = """$QPInstallTokenID"""
$QPAgentIDDBlQt = """$QPAgentID"""
$Region = """$RegionID"""
#Restart Options
<#Restart Commands
.NET lower than 4.7.2
.NET 4.7.2 or Higher Already Installed
No value Specified
After installation of .NET completes the system will automatically be restarted & After admin login, installation of the Agent system will complete and system will NOT be rebooted
After installation of the Agent system will NOT be rebooted
/NORESTART
After installation of .NET completes the system will NOT automatically be restarted & After admin login, installation of the Agent will complete and system will NOT be rebooted
After installation of the Agent system will NOT be rebooted
/FORCERESTART
After installation of .NET completes the system will automatically be restarted & After admin login, installation of the Agent will complete and system will NOT be rebooted
After installation of the Agent system will NOT be rebooted
RESTART=1
After installation of .NET completes the system will automatically be restarted & After admin login, installation of the Agent will complete and system will be rebooted
After installation of the Agent system will be rebooted
#>
$RestartOption = "/NORESTART"
#MSA vs Local System Service Options
<#MSA Commands
No Value Specified
The Agent will use the Local System Account to run the service
MSA=0
The Agent will use the Local System Account to run the service
MSA=1
A Managed Service Account will be created to run the Service
NOTE: This is only used for Domain Controllers. All other system types this command will be ignored.
#>
$MSAOption = "MSA=1"
#Test if download destination folder exists, create folder if required
If(Test-Path $Path)
{write-host "Destination folder exists"}else{
#Create Directory to download quickpass installer into
write-host "Creating folder $Path"
md $Path
}
#Begin download of Quickpass Agent
write-host "Beginning download of the quickpass agent"
Invoke-WebRequest -Uri $DownloadURL -OutFile $Output -UseBasicParsing
write-host "Variables in use for Quickpass Agent installation"
write-host "Software Path: $Output"
write-host "Installation Token: $QPInstallTokenID"
write-host "Customer ID $QPAgentID"
write-host "Restart option Selected $RestartOption"
write-host "MSA Creation Selected $MSAOption"
write-host "Beginning installation of Quickpass"
#Run QP Agent download file
Try
{
Start-Process "$Output" -ArgumentList "/quiet $RestartOption INSTALLTOKEN=$QPInstallTokenIDBLQt CUSTOMERID=$QPAgentIDDBlQt REGION=$Region $MSAOption" -ErrorAction Stop
}
Catch
{
$ErrorMessage = $_.Exception.Message
write-host "Install error was: $ErrorMessage"
#exit 1
}
#Check if service is running
$serviceName = "Quickpass Server Agent"
$maxAttempts = 3
Start-Sleep -Seconds 20 # Wait for 20 seconds
$serviceStatus = Get-Service -Name $serviceName
for ($attempt = 1; $attempt -le $maxAttempts; $attempt++) {
if ($serviceStatus.Status -eq "Running") {
Write-Host "The service '$serviceName' is now running. Quickpass Agent should have been installed successfully"
break
}
elseif ($attempt -eq $maxAttempts) {
Write-Host "Service '$serviceName' failed to start. Confirm the variables 'QPInstallTokenID' and 'QPAgentID' are defined and try again, or check the error logs."
break
}
else {
Write-Host "Waiting for service '$serviceName' to start..."
Start-Sleep -Seconds 30
$serviceStatus = Get-Service -Name $serviceName
}
}
Troubleshooting
- Ensuring MSA enabled installation allows service to start.
https://support.getquickpass.com/hc/en-us/articles/17291924425111-Using-MSA-for-Agent-on-Domain-Controllers-Resolving-Inability-to-Start-Service
Comments
1 comment
PowerShell script modified to add the following:
- Check and Report for .NET Version
- Check and Kill stuck Quickpass Agent Updates
- 2nd Script created to allow for inline specification of TenantID and AgentID
Please sign in to leave a comment.