Skip to content

Instantly share code, notes, and snippets.

@OSDeploy
Last active March 20, 2019 03:55
Show Gist options
  • Save OSDeploy/b579319922247883b7e6b8e9b078fe4b to your computer and use it in GitHub Desktop.
Save OSDeploy/b579319922247883b7e6b8e9b078fe4b to your computer and use it in GitHub Desktop.
Returns LCU Installations in your OS
[xml]$SessionsXml = Get-Content -Path "$env:WinDir\Servicing\Sessions\Sessions.xml"
$Sessions = $SessionsXml.Sessions.Session | `
Where-Object {$_.Tasks.Phase.package.id -like "*RollupFix*" -and $_.Tasks.Phase.package.targetState -eq 'Installed'}
$InstalledLCU = @()
foreach ($Session in $Sessions) {
$obj = $null
$obj = New-Object System.Object
$obj | Add-Member -type NoteProperty -Name Complete -Value $Session.Complete
$obj | Add-Member -type NoteProperty -Name Package -Value $Session.Tasks.Phase.Package.id
$InstalledLCU += $obj
}
$InstalledLCU
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment