Get-AutopilotDeviceAssociation
1.9.1
Classic Autopilot has Get-WindowsAutopilotInfo; device association did not have
an equivalent, so associating a device meant a hidden OOBE page, a USB stick and
a round trip to the Intune portal, per device.
Run it with no parameters and it does the lot: asks Windows for the genuine
TPM-backed
Classic Autopilot has Get-WindowsAutopilotInfo; device association did not have
an equivalent, so associating a device meant a hidden OOBE page, a USB stick and
a round trip to the Intune portal, per device.
Run it with no parameters and it does the lot: asks Windows for the genuine
TPM-backed DeviceLink identity package (WinRT DeviceLinkUtilities), inspects it,
imports the unchanged Data value into Intune through the Microsoft Graph beta
importTenantAssociatedDevice endpoint, waits for pre-association, runs the native
discovery and link calls that write the tenant-signed association into UEFI, then
confirms the service reports the device as associated rather than assuming it.
CheckRequirements verifies Microsoft's documented requirements against this
machine first: a physical device (virtual machines are not supported), 64-bit
Windows 11 client on a supported build (24H2 26100.9278 or 25H2 26200.9278,
KB5120998 or later) and edition, a TPM 2.0 - discrete, firmware or Microsoft
Pluton - enabled and not in Reduced Functionality Mode, UEFI firmware and Secure
Boot. Add -Online to test the required Microsoft endpoints. The device-side
actions run the same check and ask before continuing when the device does not
qualify; -Force skips the prompt.
ReadAssociation reports the Device Link UEFI markers by status, size and SHA-256
without returning their contents. Associations expire, so present is not the same
as valid: -Validate decodes the token and checks it is a well-formed RS256 JWT,
inside its validity window, with a linkId matching the DeviceLinkId UEFI variable
and tenant and device claims matching this machine. -Online verifies the
signature against the issuer's published key.
RemoveAssociation reads every known variable before deleting anything, deletes
only what is present and verifies afterwards. Add -DeleteCloudAssociation to also
delete the matching Intune record, which must match this computer exactly and
uniquely and is deleted only after local removal is verified. It does not
unenroll the device or clear the TPM.
Export, Inspect, Upload, Sync, Discover and Link also run on their own. Exit
codes are 0 success, 1 error, 2 requirements not met, so CheckRequirements works
as a gate in a task sequence.
The exported Data value is uploaded exactly as Windows produced it: the script
never fabricates, edits or re-signs an identity, and HTTP mutations have zero
automatic retries. Graph actions use Microsoft device-code sign-in by default,
with certificate or client-secret app-only authentication for unattended runs.
Every run writes a redacted diagnostic folder with one artifact per REST call.
A diagnostic and lab toolkit. It calls Windows DeviceLink interfaces and Graph
beta endpoints that can change, and removal changes UEFI state. Test it before
using it in an operational workflow.
Installation Options
Owners
Copyright
(c) 2026 Rudy Ooms. All rights reserved.
Package Details
Author(s)
- Rudy Ooms
Tags
Windows Autopilot Intune DeviceAssociation DeviceLink Autopilot-Device-Preparation OOBE
Functions
Resolve-DLRequestedAction Add-DLRedaction Protect-DLText Protect-DLObject Get-DLSha256 Get-DLAuthenticationMethod Initialize-DLLogging Write-DLLog Write-DLVerboseLog Get-DLActionPlan Initialize-DLStepPlan Invoke-DLStep ConvertTo-DLHeaders ConvertTo-DLBodyLog Get-DLHttpFailure Save-DLHttpRecord Invoke-DLRestMethod Write-DLExportSummary Invoke-DLExport Invoke-DLLink Initialize-DLFirmwareInterop Get-DLFirmwareVariable Clear-DLFirmwareVariable Get-DLFirmwareRawValue Get-DLFirmwareAssociationState Remove-DLFirmwareAssociation Get-BlobFromCsv Resolve-Csv Get-DLDelegatedGraphScopes Get-DLInteractiveGraphToken Get-GraphToken U Invoke-Inspect BI Graph-Headers Get-DLIdentifierHash ConvertTo-DLNormalizedUuid Get-DLLocalDeviceIdentity Test-DLAssociationRecordMatch Assert-DLCloudRemovalParameters Resolve-DLCloudAssociation Invoke-DLCloudAssociationDelete Wait-DLCloudAssociationDeletion Wait-PreAssociated Invoke-Upload Wait-DLAssociated Show-LinkResult ConvertFrom-DLBase64Url Get-DLStringFromBytes Get-DLGuidCandidates Expand-DLDeviceLinkJwt Get-DLJsonQuietly Resolve-DLTokenSigningKeys Test-DLJwtSignature Invoke-DLValidateAssociationToken Get-DLTpmFlavour New-DLCheck Test-DLVirtualMachine Test-DLDeviceRequirements Write-DLRequirementsReport Write-DLStopBanner Invoke-DLRequirementsPreflight Get-DLNativeErrorHint
Dependencies
This script has no dependencies.
Release Notes
Version 1.9.1 shortens the package description so it fits the PowerShell Gallery limit. The Gallery measures the raw help block including its indentation, which was 4135 bytes even though Test-ScriptFileInfo reported 3860 characters.
Version 1.9.0 makes deleting the Intune Device Association record opt-in again. RemoveAssociation clears the local UEFI variables only; add -DeleteCloudAssociation to also delete the matching Intune record. This reverts the 1.7.0 default. -KeepCloudAssociation and its -LocalOnly alias are still accepted so commands written against 1.7.0 to 1.8.2 keep working, but they now describe the default and change nothing.
Version 1.8.2 drops the 'TPM supports the association key' requirement check. It scanned the Crypto-NCrypt log for DEVICEASSOCIATION_TACK_RSA failures and blocked the run, but NTE_NOT_SUPPORTED against that key probe turns out to be common enough that the check produced false failures on devices that are otherwise fine. The 0x80090029 hint on a real association failure is kept.
Version 1.8.1 states that the TPM 2.0 requirement is met by a discrete, firmware or Microsoft Pluton TPM, and CheckRequirements now names which implementation the device has.
Version 1.8.0 gives the script meaningful exit codes - 0 success, 1 error, 2 the device does not meet the requirements - so CheckRequirements and a preflight stop no longer report success to a caller. Full also gains a sixth step that polls Intune until the record reports associated, so a successful client-side link is confirmed against the service instead of being assumed.
Version 1.7.0 makes RemoveAssociation remove the Intune Device Association record as well as the local UEFI variables by default. Use -KeepCloudAssociation (alias -LocalOnly) to clear UEFI only. -DeleteCloudAssociation is still accepted and is now a no-op, because it describes the default. The safety rules are unchanged: the cloud record must match this computer exactly and uniquely, and it is deleted only after local UEFI removal has been verified.
Version 1.6.1 replaces the raw PowerShell exception shown when the preflight stops a run with a readable summary of what is not met, how to fix it and how to override, and no longer records that clean stop as a failed run.
Version 1.6.0 makes the requirements preflight ask before continuing: Export, Sync, Discover, Link and Full now list the unmet requirements and prompt, -Force skips the prompt, and a host that cannot prompt stops instead of proceeding into a confusing native error. Native DeviceLink HRESULTs also carry a plain-language hint - 0x80004001 (E_NOTIMPL, the build predates KB5120998 and has no DeviceLink API), 0x8103C00F (no attestation material), 0x80090029 and 0x80090016 (the TPM refused the association key) and 0x80070005 (not elevated).
Version 1.5.0 adds -Action CheckRequirements, which verifies the Microsoft-documented Device Association requirements: physical device (not a VM), 64-bit Windows 11 client, a supported build (24H2 26100.9278 or 25H2 26200.9278, KB5120998 or later), a supported edition, a TPM 2.0 - discrete, firmware, or Microsoft Pluton -
enabled and not in Reduced Functionality Mode, UEFI firmware, and whether the TPM has been refusing to create the DEVICEASSOCIATION_TACK_RSA key. Adding -Online also tests the required ztd.dds.microsoft.com and attest.azure.net endpoints. The device-side actions run the same check as a non-blocking preflight and warn when the device does not qualify.
Version 1.4.0 adds -Action ReadAssociation -Validate: it decompresses DeviceLinkJwtCompressed, checks the token is a well-formed RS256 JWT, still inside its iat/exp window, has a linkId matching the DeviceLinkId UEFI variable, and (with -TenantId) a matching tenant and device inventory. Adding -Online resolves the issuer's published signing key and verifies the RS256 signature. Only booleans, timestamps and the signing-key thumbprint are printed or logged, unless -ShowClaims is added, which also prints the decoded JOSE header and payload to the console (console only; never to the diagnostic files).
Version 1.3.0 renames the script and published command to Get-AutopilotDeviceAssociation and adds a .DESCRIPTION block for PowerShell Gallery publishing. Export, Inspect, Upload, Discover, Link, ReadAssociation and RemoveAssociation behaviour is unchanged; the console banner, work folder and diagnostic file names are unchanged.
Version 1.2.0 keeps the normal console concise, moves diagnostic events to -Verbose, and selects the first returned Device Preparation policy when no policy ID or name is supplied.
FileList
- Get-AutopilotDeviceAssociation.nuspec
- Get-AutopilotDeviceAssociation.ps1
Version History
| Version | Downloads | Last updated |
|---|---|---|
| 1.9.1 (current version) | 19 | 9/4/2026 |
| 1.8.2 | 7 | 9/4/2026 |
| 1.8.0 | 52 | 9/3/2026 |
| 1.5.0 | 3 | 9/3/2026 |
| 1.3.0 | 13 | 9/1/2026 |