21 lines
932 B
PowerShell
21 lines
932 B
PowerShell
#Requires -Version 5.1
|
|
[CmdletBinding()]
|
|
param(
|
|
[ValidateSet('Inventory','Verify')][string]$Mode='Inventory',
|
|
[string]$Manifest,
|
|
[switch]$Json
|
|
)
|
|
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference='Stop'
|
|
Import-Module (Join-Path $PSScriptRoot 'src/Wind.OfflineUpdates.psm1') -Force
|
|
if ([Environment]::OSVersion.Platform -ne [PlatformID]::Win32NT) { throw 'Windows is required.' }
|
|
$target=Get-WindUpdateTarget
|
|
if ($Mode -eq 'Inventory') {
|
|
if ($Manifest) { throw 'Manifest is only used with Verify.' }
|
|
$result=[pscustomobject]@{Target=$target;Scope='Local OS version/edition/architecture only. No machine name, account, serial, GDID, IP address or recovery key.'}
|
|
} else {
|
|
if (-not $Manifest) { throw 'Verify requires an absolute local -Manifest path.' }
|
|
$result=Test-WindOfflineBundle -Manifest $Manifest -Target $target
|
|
}
|
|
if ($Json) { $result | ConvertTo-Json -Depth 8 } else { $result | Format-List }
|