QuickBooks Desktop
PowerShell script to silently install multiple versions of QuickBooks desktop.
Overview
This script uses the provided Product Numbers to download and install multiple versions of QuickBooks desktop in a single pass. It is most useful for deployment of new devices for accountants, who often have requirements to maintain multiple versions of QuickBooks desktop.
Prerequisites:
Collect the Product & License Numbers for the versions of QuickBooks you will be installing.
Ensure the script supports the desired versions. If the script does not support your desired versions, you will need to add them ahead of time.
Optional: Download the installers and place them in a directory that will be accessible to the script at runtime.
Notes:
Script will abort if run as SYSTEM; it must be run as an administrative user.
While this script can install multiple versions of QuickBooks Desktop in a single pass, installed versions will use a single license key. If you need to install various QuickBooks versions with different license keys side-by-side, you will need to run the script for each key.
The required PDF components (Microsoft XPS Document Writer) will be enabled, if not already.
View uncommented lines in the
$QBVersions
array in the script for currently supported versions.
Script
Script will abort if run as SYSTEM; it must be run as an administrative user.
<#
.SYNOPSIS
Installs QuickBooks Desktop
.DESCRIPTION
Installs the specified version of QuickBooks Desktop
.EXAMPLE
InstallQuickBooks.ps1 -Cache "\\SERVER\QuickBooks\Installers" -ProductNumbers 757-611,334-562 -ToolHub
.PARAMETER Cache
Optional - Directory path to QuickBooks installers. If not provided, installers will be downloaded from Intuit.
.PARAMETER LicenseNumber
Optional - License number to use for QuickBooks installations. If not provided, '0000-0000-0000-000' will be used.
.PARAMETER ProductNumbers
Required - Array parameter that accepts product numbers for the versions of QuickBooks you want to install.
.PARAMETER ToolHub
Optional - Switch parameter to install QuickBooks ToolHub.
.NOTES
Author: Aaron J. Stevenson
#>
param(
[String]$Cache,
[ValidatePattern('^(?:\d{4}-){3}\d{3}$|^\d{15}$')]
[Alias('License')]
[String]$LicenseNumber = '0000-0000-0000-000',
[Parameter(Mandatory = $true)]
[Alias('ID', 'Product', 'Products', 'ProductNumber')]
[String[]]$ProductNumbers,
[Switch]$ToolHub
)
Function Confirm-SystemCheck {
$CurrentUserSID = ([System.Security.Principal.WindowsIdentity]::GetCurrent()).User.Value
if ($CurrentUserSID -eq 'S-1-5-18') {
Write-Warning 'This script cannot run as SYSTEM. Please run as admin.'
exit 1
}
}
Function Install-XPSDocumentWriter {
$XPSFeature = Get-WindowsOptionalFeature -Online | Where-Object { $_.FeatureName -eq 'Printing-XPSServices-Features' }
if ($XPSFeature.State -eq 'Disabled') {
try {
Write-Output "`nInstalling required PDF components (Microsoft XPS Document Writer)..."
Enable-WindowsOptionalFeature -Online -FeatureName 'Printing-XPSServices-Features' -All -NoRestart | Out-Null
Write-Output 'Installation complete.'
}
catch {
Write-Warning 'Unable to install Microsoft XPS Document Writer feature.'
Write-Warning '$_'
}
}
}
Function Install-QuickBooks {
param(
[Parameter(Mandatory = $True, ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $True)]
[PSObject]$QuickBooks
)
$Exe = ($QuickBooks.URL -Split '/')[-1]
$Installer = Join-Path -Path $env:TEMP -ChildPath $Exe
if (Test-Path ("$Cache\$Exe")) { $CacheInstaller = Join-Path -Path $Cache -ChildPath $Exe }
try {
if ($CacheInstaller) {
Write-Output "`nCopying $($QuickBooks.Name) installer from cache..."
Copy-Item -Path $CacheInstaller -Destination $Installer
}
else {
Write-Output "`nDownloading $($QuickBooks.Name) installer..."
Invoke-WebRequest -Uri $QuickBooks.URL -OutFile $Installer
}
Write-Output 'Installing...'
Start-Process -Wait -NoNewWindow -FilePath $Installer -ArgumentList "-s -a QBMIGRATOR=1 MSICOMMAND=/s QB_PRODUCTNUM=$($QuickBooks.ProductNumber) QB_LICENSENUM=$LicenseNumber"
Write-Output 'Installation complete.'
}
catch {
Write-Warning "Error installing $($QuickBooks.Name):"
Write-Warning $_
}
finally { Remove-Item $Installer -Force -ErrorAction Ignore }
}
Function Install-ToolHub {
$ToolHubURL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/QBFDT/QuickBooksToolHub.exe'
$Exe = ($ToolHubURL -Split '/')[-1]
$Installer = Join-Path -Path $env:TEMP -ChildPath $Exe
if (Test-Path ("$Cache\$Exe")) { $CacheInstaller = Join-Path -Path $Cache -ChildPath $Exe }
try {
if ($CacheInstaller) {
Write-Output "`nCopying ToolHub installer from cache..."
Copy-Item -Path $CacheInstaller -Destination $Installer
}
else {
Write-Output "`nDownloading ToolHub installer..."
Invoke-WebRequest -Uri $ToolHubURL -OutFile $Installer
}
Write-Output 'Installing...'
Start-Process -Wait -NoNewWindow -FilePath $Installer -ArgumentList '/S /v/qn'
Write-Output 'Installation complete.'
}
catch {
Write-Warning 'Error installing ToolHub:'
Write-Warning $_
}
finally { Remove-Item $Installer -Force -ErrorAction Ignore }
}
# Abort if running as SYSTEM
Confirm-SystemCheck
# Adjust PowerShell settings
$ProgressPreference = 'SilentlyContinue'
if ([Net.ServicePointManager]::SecurityProtocol -notcontains 'Tls12' -and [Net.ServicePointManager]::SecurityProtocol -notcontains 'Tls13') {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
}
# Format parameters
if ($Cache) { $Cache = $Cache.TrimEnd('\') }
$ProductNumbers = ($ProductNumbers -replace '-', '' -replace ' ', '').Split(',')
$QBVersions = @(
# Add additional versions
# Get download url from https://downloads.quickbooks.com/app/qbdt/products
# [PSCustomObject]@{Name = 'QuickBooks [Flavor] [Year]'; ProductNumber = '[Product Number]'; URL = '[Download URL]'; }
# QuickBooks Pro
[PSCustomObject]@{Name = 'QuickBooks Pro 2023'; ProductNumber = '401228'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2023/Latest/QuickBooksProSub2023.exe'; }
[PSCustomObject]@{Name = 'QuickBooks Pro 2022'; ProductNumber = '917681'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2022/Latest/QuickBooksProSub2022.exe'; }
[PSCustomObject]@{Name = 'QuickBooks Pro 2021'; ProductNumber = '222750'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2021/Latest/QuickBooksPro2021.exe'; }
[PSCustomObject]@{Name = 'QuickBooks Pro 2020'; ProductNumber = '748990'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2020/Latest/QuickBooksPro2020.exe'; }
[PSCustomObject]@{Name = 'QuickBooks Pro 2019'; ProductNumber = '102058'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2019/Latest/QuickBooksPro2019.exe'; }
# QuickBooks Pro Accountant
[PSCustomObject]@{Name = 'QuickBooks Pro 2019 - Accountant'; ProductNumber = '589041'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2019/Latest/QuickBooksPro2019.exe'; }
# QuickBooks Premier Accountant
[PSCustomObject]@{Name = 'QuickBooks Premier 2023'; ProductNumber = '757611'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2023/Latest/QuickBooksPremierSub2023.exe'; }
[PSCustomObject]@{Name = 'QuickBooks Premier 2022'; ProductNumber = '747060'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2022/Latest/QuickBooksPremier2022.exe'; }
[PSCustomObject]@{Name = 'QuickBooks Premier 2021'; ProductNumber = '622091'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2021/Latest/QuickBooksPremier2021.exe'; }
[PSCustomObject]@{Name = 'QuickBooks Premier 2020'; ProductNumber = '247211'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2020/Latest/QuickBooksPremier2020.exe'; }
[PSCustomObject]@{Name = 'QuickBooks Premier 2019'; ProductNumber = '355957'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2019/Latest/QuickBooksPremier2019.exe'; }
# QuickBooks Enterprise
[PSCustomObject]@{Name = 'QuickBooks Enterprise 24'; ProductNumber = '045169'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2024/Latest/QuickBooksEnterprise24.exe'; }
[PSCustomObject]@{Name = 'QuickBooks Enterprise 23'; ProductNumber = '916783'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2023/Latest/QuickBooksEnterprise23.exe'; }
[PSCustomObject]@{Name = 'QuickBooks Enterprise 22'; ProductNumber = '029966'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2022/Latest/QuickBooksEnterprise22.exe'; }
[PSCustomObject]@{Name = 'QuickBooks Enterprise 21'; ProductNumber = '176962'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2021/Latest/QuickBooksEnterprise21.exe'; }
[PSCustomObject]@{Name = 'QuickBooks Enterprise 20'; ProductNumber = '194238'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2020/Latest/QuickBooksEnterprise20.exe'; }
[PSCustomObject]@{Name = 'QuickBooks Enterprise 19'; ProductNumber = '490580'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2019/Latest/QuickBooksEnterprise19.exe'; }
# QuickBooks Enterprise Accountant
[PSCustomObject]@{Name = 'QuickBooks Enterprise 23 - Accountant'; ProductNumber = '334562'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2023/Latest/QuickBooksEnterprise23.exe'; }
[PSCustomObject]@{Name = 'QuickBooks Enterprise 22 - Accountant'; ProductNumber = '884649'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2022/Latest/QuickBooksEnterprise22.exe'; }
#[PSCustomObject]@{Name = 'QuickBooks Enterprise 21 - Accountant'; ProductNumber = ''; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2021/Latest/QuickBooksEnterprise21.exe'; }
[PSCustomObject]@{Name = 'QuickBooks Enterprise 20 - Accountant'; ProductNumber = '239629'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2020/Latest/QuickBooksEnterprise20.exe'; }
[PSCustomObject]@{Name = 'QuickBooks Enterprise 19 - Accountant'; ProductNumber = '454852'; URL = 'https://dlm2.download.intuit.com/akdlm/SBD/QuickBooks/2019/Latest/QuickBooksEnterprise19.exe'; }
)
# Install necessary PDF components
Install-XPSDocumentWriter
# Find Product Number & Install
foreach ($ProductNumber in $ProductNumbers) {
$QBVersion = $QBVersions | Where-Object { $_.ProductNumber -match $ProductNumber }
if (!$QBVersion) { Write-Warning "Product number [$ProductNumber] is not currently supported by this script." }
else { $QBVersion | Install-QuickBooks }
}
# Install ToolHub
if ($ToolHub) { Install-ToolHub }
Examples
Example 1
.\InstallQuickBooks.ps1 -ID 401228,917681
This example uses only the required parameter, ProductNumbers
(alias ID
) to download and install QuickBooks Pro 2022 & QuickBooks Pro 2023. Notably, it uses a default license key of '0000-0000-0000-000'. The correct license key will need to be manually added before QuickBooks is used.
Example 2
.\InstallQuickBooks.ps1 -Cache '\\SERVER\QuickBooks Installers' -License 1234-5678-9101-234 -ID 401-228,917-681 -ToolHub
This example, in addition to the required ProductNumbers
(alias ID
) parameter, uses the available optional parameters to install QuickBooks Pro 2022 & QuickBooks Pro 2023.
The Cache
parameter is used to provide a path to pre-downloaded QuickBooks Desktop installers.
The LicenseNumber
(alias License
) parameter is used to supply the correct License Number for QuickBooks. The same license number will be used for all supplied Product Numbers. If multiple license numbers are required, the script will need to be run for each License Number.
The ToolHub
parameter is used to install QuickBooks ToolHub alongside the selected versions of QuickBooks Desktop.
Parameters
Required Parameters
-ProductNumbers
Aliases: -ID
, -Product
, -Products
, -ProductNumber
Array parameter that accepts multiple QuickBooks Product Numbers with or without dashes. Supplied Product Numbers will be compared with the $QBVersions
array to determine which versions of QuickBooks to install.
Optional Parameters
-Cache
String parameter that allows you to provide a directory file path to pre-downloaded QuickBooks installers. If this parameter is not used or the path is invalid/inaccessible, the QuickBooks installers will be downloaded directly from Intuit.
Note: This parameter assumes that the file names in the cache directory match the file names for the installers downloaded from Intuit.
-LicenseNumber
Aliases: -License
String parameter that allows you to supply the QuickBooks License Number (with or without dashes) for the versions of QuickBooks the script is installing. If this parameter is not used, a license number of 0000-0000-0000-000 will be used. The correct license can be added to QuickBooks after installation via Help < Manage My License < Change My License in QuickBooks Desktop.
-ToolHub
Switch parameter that can be used to install the QuickBooks Tool Hub application alongside QuickBooks.
Last updated
Was this helpful?