PSAppDeployToolkit with Intune Part 2

How to Update SSMS Using PSAppDeployToolkit and Intune

Liladhar Sapkota - Author
Liladhar Sapkota•Updated

Update an existing SSMS 22 installation

This walkthrough builds a PSAppDeployToolkit (PSADT) v4.1.8 package that updates an existing SQL Server Management Studio (SSMS) 22 Release installation. PSADT runs Microsoft's installer and records the result; Intune distributes the package and checks the installed version.

The example minimum version is 22.12.1, listed in Microsoft's release history on 24 November 2026. Replace it with your approved version when preparing a future package. A newer installed 22.x version also satisfies detection.

Scope: This updates the SSMS desktop application. It does not patch the SQL Server database engine, install SSMS on a new device, or migrate SSMS 18–21 to 22. Treat a change of major version as a separate deployment.

About the screenshots: These captures show the official PSADT downloads and Microsoft setup references, with source links beside the steps. The example scripts have been syntax-checked and their control flow tested with a simulated installer; validate a real SSMS update on your own pilot device before deployment.

Before you start

  • A Windows x64 pilot device with one working SSMS 22 Release installation and local administrator access.
  • The official PSADT 4.1.8 v4 template. Use PSAppDeployToolkit_Template_v4.zip.
  • The Microsoft SSMS bootstrapper for the release you approved, saved as vs_SSMS.exe.
  • Access to the configured Microsoft update source from the account that runs setup. A user-browser download test does not prove that the SYSTEM account can download through your proxy.
  • For Intune: Win32 app administration access, a pilot device group, and the Microsoft Win32 Content Prep Tool.

Ask users to save queries and close SSMS before the maintenance window. This example returns a retry code when Ssms.exe is running; it does not force the application to close. Microsoft documents the close-before-update requirement in its SSMS update guide.

1

Prepare the PSADT source folder

  1. Extract the entire v4 template to C:\IntuneApps\SSMS22-Update.
  2. Place vs_SSMS.exe inside Files.
  3. Open Invoke-AppDeployToolkit.ps1 in Visual Studio Code.
  4. Keep the packaging tool, generated .intunewin file, and detection scripts outside this source folder.
C:\IntuneApps\SSMS22-Update
├── Assets
├── Config
├── Files
│   └── vs_SSMS.exe
├── PSAppDeployToolkit
├── PSAppDeployToolkit.Extensions
├── Strings
├── SupportFiles
├── Invoke-AppDeployToolkit.exe
└── Invoke-AppDeployToolkit.ps1
Official PSADT release assets including PSAppDeployToolkit Template v4 zip
Download PSAppDeployToolkit_Template_v4.zip from the official PSADT release. The v3 template and module-only archive have different contents. Select the image to view it full size.
Microsoft SSMS release history showing the 22.12.1 bootstrapper download
Select the approved SSMS bootstrapper in Microsoft release history, then save it in Files as vs_SSMS.exe. Captured on 24 November 2026. Select the image to view it full size.

Check the downloaded bootstrapper before packaging:

Get-AuthenticodeSignature 'C:\IntuneApps\SSMS22-Update\Files\vs_SSMS.exe' |
    Select-Object Status, @{Name='Publisher'; Expression={$_.SignerCertificate.Subject}}

(Get-Item 'C:\IntuneApps\SSMS22-Update\Files\vs_SSMS.exe').VersionInfo |
    Select-Object ProductName, ProductVersion, FileVersion

Expect a valid Microsoft signature and the intended product version. The bootstrapper's FileVersion belongs to the setup program; it is not the installed SSMS version used by this guide's detection script.

Online versus offline: A small vs_SSMS.exe file is a downloader. The evergreen link can deliver a newer release later. For a controlled version or disconnected devices, prepare and test the matching offline layout with the required components. Adding --noWeb to this bootstrapper-only package will not make it an offline installer.
2

Set the app name and approved version

Find the existing $adtSession = @{ ... } block. Change these entries inside it, preserving the template's other properties and initialization code. This is a settings excerpt, not a replacement for the entire script.

# Change these entries inside the template's existing $adtSession.
# Keep its remaining properties, initialization, and error handling.
AppVendor = 'Microsoft'
AppName = 'SQL Server Management Studio 22 Update'
AppVersion = '22.12.1'
AppArch = 'x64'
AppRevision = '01'
AppSuccessExitCodes = @(0)
AppRebootExitCodes = @(1641, 3010)
AppProcessesToClose = @()
AppScriptVersion = '1.0.0'
AppScriptDate = '2026-11-24'
AppScriptAuthor = 'Liladhar Sapkota'
RequireAdmin = $true

AppProcessesToClose stays empty because the update function below handles an open SSMS session by returning 69001. The package runs silently and leaves users' unsaved work alone.

3

Find the exact SSMS installation

On the pilot device, run this read-only command and inspect channelId, installationPath, and catalog.productDisplayVersion:

$vswhere = Join-Path ([Environment]::GetFolderPath('ProgramFilesX86')) 'Microsoft Visual Studio\Installer\vswhere.exe'
& $vswhere -all -products Microsoft.VisualStudio.Product.SSMS -format json

The package selects SSMS.22.SSMS.Release. It rejects missing, incomplete, or multiple matching installations so it cannot silently update the wrong instance. Use the installed product's display version for comparison; setup engine build numbers can differ.

Add this helper function above Install-ADTDeployment in the template:

function Get-Ssms22Instance {
    $programFilesX86 = [Environment]::GetFolderPath('ProgramFilesX86')
    $vswhere = Join-Path $programFilesX86 'Microsoft Visual Studio\Installer\vswhere.exe'
    if (!(Test-Path -LiteralPath $vswhere -PathType Leaf)) {
        throw 'Visual Studio Installer discovery tool was not found.'
    }

    $json = & $vswhere -all -products Microsoft.VisualStudio.Product.SSMS -format json
    if ($LASTEXITCODE -ne 0) { throw 'SSMS instance discovery failed.' }
    $instances = @(
        $json | ConvertFrom-Json -ErrorAction Stop | Where-Object {
            $_.channelId -eq 'SSMS.22.SSMS.Release'
        }
    )
    if ($instances.Count -ne 1) {
        throw 'Expected one SSMS 22 Release instance. Review this device manually.'
    }

    $instance = $instances[0]
    if (!$instance.isComplete -or !$instance.isLaunchable) {
        throw 'SSMS installation is incomplete. Check setup and pending restarts.'
    }
    $version = [version]$instance.catalog.productDisplayVersion
    $exe = Join-Path $instance.installationPath 'Common7\IDE\Ssms.exe'
    if ($version.Major -ne 22 -or !(Test-Path -LiteralPath $exe -PathType Leaf)) {
        throw 'SSMS version or executable does not match the expected installation.'
    }
    [pscustomobject]@{
        InstallPath = $instance.installationPath
        Version = $version
    }
}

Microsoft's instance discovery documentation explains the bundled vswhere.exe tool. If your inventory differs from this guide, resolve the path/channel/version mapping before assigning the package.

4

Replace the install function with update logic

Replace the template's entire Install-ADTDeployment function with the following block. Leave the module import, session initialization, and final invocation/error handling intact. Replacing the function also removes the template's example success dialog and default process-closing prompt.

function Install-ADTDeployment {
    $adtSession.InstallPhase = 'Pre-Install'
    $minimumVersion = [version]$adtSession.AppVersion
    $before = Get-Ssms22Instance

    if ($before.Version -ge $minimumVersion) {
        Write-ADTLogEntry -Message "SSMS $($before.Version) already meets the target."
        return
    }
    if (Get-Process -Name 'Ssms' -ErrorAction SilentlyContinue) {
        Write-ADTLogEntry -Message 'SSMS is open. Retry after the user saves and closes it.'
        Close-ADTSession -ExitCode 69001
        return
    }

    $installer = Join-Path $adtSession.DirFiles 'vs_SSMS.exe'
    if (!(Test-Path -LiteralPath $installer -PathType Leaf)) {
        throw 'Place the approved vs_SSMS.exe bootstrapper in Files.'
    }
    $adtSession.InstallPhase = 'Install'
    $processOptions = @{
        FilePath = $installer
        ArgumentList = 'update --installPath "{0}" --quiet --wait --norestart' -f $before.InstallPath
        SuccessExitCodes = @(0)
        RebootExitCodes = @(1641, 3010)
        IgnoreExitCodes = @(1001, 1003, 1618)
        PassThru = $true
        ErrorAction = 'Stop'
    }
    $result = Start-ADTProcess @processOptions

    # Preserve restart/retry results; never report these as an ordinary success.
    if ($result.ExitCode -ne 0) {
        Close-ADTSession -ExitCode $result.ExitCode
        return
    }

    $adtSession.InstallPhase = 'Post-Install'
    $after = Get-Ssms22Instance
    if ($after.Version -lt $minimumVersion) {
        throw "Setup finished but SSMS $($after.Version) is below $minimumVersion."
    }
    Write-ADTLogEntry -Message "Verified SSMS $($after.Version) at $($after.InstallPath)."
}

The installer command uses the update verb and the discovered --installPath. --quiet hides installer UI, --wait keeps the bootstrapper running until setup finishes, and --norestart defers an automatic restart. Microsoft documents these in its command-line reference. --wait is a bootstrapper option; do not copy it to Visual Studio Installer's setup.exe.

Microsoft Learn command-line examples for updating SQL Server Management Studio
Reference capture from Microsoft Learn: the documented update command. Its --noWeb example requires a prepared layout; this guide uses the online command shown above. Select the image to view it full size.

Make unsupported actions explicit. This is an update-only package. Replace the template's uninstall and repair functions with these guards so an empty template function cannot report a successful removal or repair:

function Uninstall-ADTDeployment {
    Write-ADTLogEntry -Message 'This update-only package does not remove SSMS.' -Severity 3
    Close-ADTSession -ExitCode 69002
}

function Repair-ADTDeployment {
    Write-ADTLogEntry -Message 'Use Visual Studio Installer for an approved repair.' -Severity 3
    Close-ADTSession -ExitCode 69002
}

Use a separate, tested removal workflow if you need to uninstall SSMS. An uninstall assignment is not a rollback strategy for this package.

5

Test locally before uploading

On an approved pilot device, save work and close SSMS. Run the package from an elevated PowerShell window and capture its exit code:

Set-Location 'C:\IntuneApps\SSMS22-Update'
$test = Start-Process -FilePath '.\Invoke-AppDeployToolkit.exe' -ArgumentList '-DeploymentType Install -DeployMode Silent' -Wait -PassThru
$test.ExitCode

After a successful update, restart if requested, open SSMS, and check Help > About. Compare that result with the discovery command and run the detection script from the next step. Repeat the package once: an already compliant installation should skip setup.

Test caseExpected behavior
Older SSMS 22 Release, app closedSetup runs; the installed version reaches the approved minimum.
Target or newer 22.x already installedNo installer runs; detection succeeds.
SSMS is open and needs updatingReturns 69001 for a later retry; no forced close.
Only SSMS 20/21, or no SSMSIntune requirement is false. A manual invocation fails clearly.
Setup requires a restartPreserves 3010; verify again after the managed restart.
Network unavailable or setup failsA failure is recorded; a failed install is not converted into success.
Multiple or incomplete SSMS 22 instancesStops for manual review.

An elevated local test is only the first check. Test the Intune deployment in SYSTEM context on the pilot group to validate proxy access, download behavior, timing, and restart reporting.

6

Detect the version, not just the app

An existence-only rule can make Intune treat an old SSMS release as already updated. Use the same 22.12.1 minimum in the package metadata and detection script, comparing with -ge so newer versions remain compliant.

Download Detect-SSMS22.ps1. It is standalone and includes the discovery helper; PSADT does not need to be installed on the device for detection.

Show the complete detection script
function Get-Ssms22Instance {
    $programFilesX86 = [Environment]::GetFolderPath('ProgramFilesX86')
    $vswhere = Join-Path $programFilesX86 'Microsoft Visual Studio\Installer\vswhere.exe'
    if (!(Test-Path -LiteralPath $vswhere -PathType Leaf)) {
        throw 'Visual Studio Installer discovery tool was not found.'
    }

    $json = & $vswhere -all -products Microsoft.VisualStudio.Product.SSMS -format json
    if ($LASTEXITCODE -ne 0) { throw 'SSMS instance discovery failed.' }
    $instances = @(
        $json | ConvertFrom-Json -ErrorAction Stop | Where-Object {
            $_.channelId -eq 'SSMS.22.SSMS.Release'
        }
    )
    if ($instances.Count -ne 1) {
        throw 'Expected one SSMS 22 Release instance. Review this device manually.'
    }

    $instance = $instances[0]
    if (!$instance.isComplete -or !$instance.isLaunchable) {
        throw 'SSMS installation is incomplete. Check setup and pending restarts.'
    }
    $version = [version]$instance.catalog.productDisplayVersion
    $exe = Join-Path $instance.installationPath 'Common7\IDE\Ssms.exe'
    if ($version.Major -ne 22 -or !(Test-Path -LiteralPath $exe -PathType Leaf)) {
        throw 'SSMS version or executable does not match the expected installation.'
    }
    [pscustomobject]@{
        InstallPath = $instance.installationPath
        Version = $version
    }
}

# Standalone Intune detection: no PSADT module is needed.
try {
    $minimumVersion = [version]'22.12.1'
    $installed = Get-Ssms22Instance
    if ($installed.Version -ge $minimumVersion) {
        Write-Output "SSMS $($installed.Version) detected"
        exit 0
    }
} catch {
    # No success output for absent, ambiguous, incomplete, or unreadable installs.
}
exit 1
  • Rules format: Use a custom detection script.
  • Script file: Detect-SSMS22.ps1.
  • Run script as 32-bit process on 64-bit clients: No.
  • Signature enforcement: Follow your organization's policy; sign the script if enforcement is enabled.

Intune needs both exit code 0 and output on STDOUT to detect an app. A missing or older installation returns 1 without success output. See Microsoft's Win32 detection guidance.

7

Package and configure the Intune app

Run the Microsoft content prep tool outside the source directory. The output directory must also be outside the package source:

& 'C:\Tools\IntuneWinAppUtil.exe' -c 'C:\IntuneApps\SSMS22-Update' -s 'Invoke-AppDeployToolkit.exe' -o 'C:\IntuneApps\Output' -q

In Intune admin center > Apps > Windows, create a Windows app (Win32) and upload Invoke-AppDeployToolkit.intunewin. Use a clear name such as SSMS 22 Update — minimum 22.12.1.

SettingValue for this example
Install commandInvoke-AppDeployToolkit.exe -DeploymentType Install -DeployMode Silent
Uninstall command (required field)Invoke-AppDeployToolkit.exe -DeploymentType Uninstall -DeployMode Silent
This calls the explicit 69002 guard, not a removal operation. Do not create uninstall assignments.
Install behaviorSystem
Allow available uninstallNo
Device restart behaviorDetermine behavior based on return codes
Architecture / OSx64; an OS supported by your approved SSMS release
Installation timeoutSet from your slowest successful pilot run, with room for downloads

Add an existing-install requirement. Upload Require-SSMS22.ps1 as a custom requirement script. Run it in 64-bit context under SYSTEM, with output type Integer, operator Equals, and value 1. This prevents an update-only app from repeatedly failing on machines without a qualifying SSMS installation.

Show the complete requirement script
function Get-Ssms22Instance {
    $programFilesX86 = [Environment]::GetFolderPath('ProgramFilesX86')
    $vswhere = Join-Path $programFilesX86 'Microsoft Visual Studio\Installer\vswhere.exe'
    if (!(Test-Path -LiteralPath $vswhere -PathType Leaf)) {
        throw 'Visual Studio Installer discovery tool was not found.'
    }

    $json = & $vswhere -all -products Microsoft.VisualStudio.Product.SSMS -format json
    if ($LASTEXITCODE -ne 0) { throw 'SSMS instance discovery failed.' }
    $instances = @(
        $json | ConvertFrom-Json -ErrorAction Stop | Where-Object {
            $_.channelId -eq 'SSMS.22.SSMS.Release'
        }
    )
    if ($instances.Count -ne 1) {
        throw 'Expected one SSMS 22 Release instance. Review this device manually.'
    }

    $instance = $instances[0]
    if (!$instance.isComplete -or !$instance.isLaunchable) {
        throw 'SSMS installation is incomplete. Check setup and pending restarts.'
    }
    $version = [version]$instance.catalog.productDisplayVersion
    $exe = Join-Path $instance.installationPath 'Common7\IDE\Ssms.exe'
    if ($version.Major -ne 22 -or !(Test-Path -LiteralPath $exe -PathType Leaf)) {
        throw 'SSMS version or executable does not match the expected installation.'
    }
    [pscustomobject]@{
        InstallPath = $instance.installationPath
        Version = $version
    }
}

# Standalone Intune requirement: only existing SSMS 22 Release devices qualify.
try {
    $null = Get-Ssms22Instance
    Write-Output '1'
} catch {
    Write-Output '0'
}
exit 0

Keep normal success/restart mappings and add the retry codes used by this package:

Exit codeIntune typeMeaning
0SuccessUpdated and verified, or already at the minimum.
3010Soft rebootSetup succeeded and needs a restart.
1641Hard rebootSetup reports that a restart was initiated.
1001 / 1618Retry (each code separately)Installer already running / another installation in progress.
1003 / 69001Retry (each code separately)SSMS is in use, detected by setup or by our precheck.
69002FailedUnsupported uninstall or repair request.

Leave other failures as failures. Intune retry attempts are limited; use monitoring and a maintenance window if users leave SSMS open for long periods.

8

Supersede the older SSMS 22 app

  1. Open the new Win32 app's Supersedence settings and select the previous SSMS 22 app, if one is managed in Intune.
  2. Set Uninstall previous version = No. The update command needs the existing installation.
  3. Assign the new app as Required to a small pilot device group.
  4. Check install status, installed version, restart results, and application launch before expanding the assignment.
  5. Review the older app's detection and assignments so it does not try to reinstall an older version after the update.

Supersedence describes the relationship between apps; assignments determine rollout. If you do not already manage SSMS through Intune, use the existing-install requirement and pilot assignment without adding a supersedence relationship. Microsoft explains the update-versus-replace behavior in its supersedence guidance.

Recovery: If the pilot reveals a problem, pause the new assignment and investigate the logs. Do not automatically remove SSMS or push an older installer as a downgrade. Test a vendor-supported recovery procedure separately.

Logs and troubleshooting

Start with the PSADT log location configured in Config\config.psd1. Match the time and exit code to setup's dd_* logs in the executing account's temporary directory. Under SYSTEM, inspect C:\Windows\Temp; a local administrator test uses that user's temp folder. Intune logs are under C:\ProgramData\Microsoft\IntuneManagementExtension\Logs.

SymptomWhat to check
Guide command does not work with SSMS-Setup-ENU.exeThat is an older installer family. This example uses SSMS 22's vs_SSMS.exe bootstrapper.
Setup finishes too earlyConfirm the bootstrapper command includes --wait and PSADT is not using -NoWait.
App installed, Intune says not detectedRun detection in 64-bit PowerShell. Compare the channel, product display version, minimum version, and pending restart.
Intune says not applicableCheck the requirement result. Missing, multiple, or incomplete instances deliberately return 0.
Works locally, fails as SYSTEMInspect installer downloads, proxy/source access, and SYSTEM temp logs.
SSMS remains below the minimumVerify the bootstrapper and configured update channel supply the approved release.
Repeated 69001 or 1003Have the user save and close SSMS, then retry within the maintenance window.

See Microsoft's SSMS setup troubleshooting and Intune Win32 troubleshooting for additional diagnostics.

Before expanding beyond the pilot

  • The bootstrapper signature and intended release have been checked.
  • Metadata and detection use the same minimum version.
  • The package discovers the correct SSMS 22 Release instance and installation path.
  • Open SSMS sessions produce a retry rather than losing unsaved queries.
  • Upgrade, already-current, missing-app, download-failure, and reboot cases have been tested.
  • Intune uses System install behavior, 64-bit scripts, and the custom requirement.
  • The older app is not uninstalled before the update; conflicting assignments have been reviewed.
  • A successful pilot confirms both Intune detection and SSMS launch after any required restart.

Official references

Documentation checked on 24 November 2026. Recheck release details before reusing this example for a future update.

Continue with Intune Win32 application troubleshooting, or revisit PSADT Part 1 for the basic package structure.

Liladhar Sapkota - IT Professional

About Liladhar Sapkota

Liladhar Sapkota is an IT professional with expertise in Microsoft 365, Intune, and automation. Writing documentation based on real production experience.