Private/Get-ADPDDevicePreparationTracking.ps1
|
function Get-ADPDDevicePreparationTracking { [CmdletBinding()] param() $trackingPath = 'HKLM:\SOFTWARE\Microsoft\Windows\Autopilot\EnrollmentStatusTracking\Device\DevicePreparation' try { $providers = @(Get-ChildItem -Path $trackingPath -ErrorAction Stop | ForEach-Object { $properties = Get-ItemProperty -Path $_.PSPath -ErrorAction SilentlyContinue [pscustomobject]@{ Provider = $_.PSChildName InstallationState = $properties.InstallationState LastError = $properties.LastError } }) [pscustomobject]@{ Available = $true Providers = $providers Error = $null } } catch { [pscustomobject]@{ Available = $false Providers = @() Error = $_.Exception.Message } } } |