Public/Catalog.ps1
|
function Get-MgWindowsUpdateCatalogEntryBeta { <# .SYNOPSIS Gets Windows update catalog entries from the beta API. .DESCRIPTION Gets Windows update catalog entries from the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.Read.All or WindowsUpdates.ReadWrite.All in the active Microsoft Graph context. .PARAMETER All Follows Microsoft Graph pagination links until all result pages are returned. .PARAMETER Count Requests the OData count annotation. .PARAMETER Expand Specifies related resources to include through OData $expand. .PARAMETER Filter Specifies an OData $filter expression. .PARAMETER OrderBy Specifies an OData $orderby expression. .PARAMETER Query Specifies additional OData query parameters as key-value pairs. .PARAMETER Select Specifies properties to include through OData $select. .PARAMETER Skip Specifies the number of items to skip. .PARAMETER Top Specifies the maximum number of items requested from Microsoft Graph. .EXAMPLE PS> Get-MgWindowsUpdateCatalogEntryBeta ` -Select id ` -All Gets Windows update catalog entries from the beta API. The example requests useful identity fields and follows all pages when the endpoint supports pagination. #> [CmdletBinding()] param( [string] $Filter, [string[]] $Select, [string[]] $Expand, [string[]] $OrderBy, [ValidateRange(1, 999)] [int] $Top, [ValidateRange(0, [int]::MaxValue)] [int] $Skip, [switch] $Count, [switch] $All, [hashtable] $Query ) $odata = Get-MgWindowsUpdatesQuery -BoundParameters $PSBoundParameters Invoke-MgWindowsUpdatesRequest -Method GET -Path 'catalog/entries' -Query $odata -All:$All } function Find-MgWindowsUpdateProductByCatalogIdBeta { <# .SYNOPSIS Finds product revisions associated with a catalog ID using the beta API. .DESCRIPTION Finds product revisions associated with a catalog ID using the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.Read.All or WindowsUpdates.ReadWrite.All in the active Microsoft Graph context. .PARAMETER CatalogId Specifies the Windows update catalog identifier. .EXAMPLE PS> $product = Find-MgWindowsUpdateProductByCatalogIdBeta -CatalogId $catalogEntry.catalogId $product | Select-Object id,displayName Finds the Windows product associated with a catalog entry and displays its identity. #> [CmdletBinding()] param( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string] $CatalogId ) $value = ConvertTo-MgWindowsUpdatesODataString -Value $CatalogId Invoke-MgWindowsUpdatesRequest -Method GET -Path "products/FindByCatalogId(catalogID='$value')" } function Find-MgWindowsUpdateProductByKbNumberBeta { <# .SYNOPSIS Finds product revisions associated with a KB number using the beta API. .DESCRIPTION Finds product revisions associated with a KB number using the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.Read.All or WindowsUpdates.ReadWrite.All in the active Microsoft Graph context. .PARAMETER KbNumber Specifies the numeric Windows update KB number. .EXAMPLE PS> Find-MgWindowsUpdateProductByKbNumberBeta -KbNumber 5030211 Finds Windows products associated with KB5030211. #> [CmdletBinding()] param( [Parameter(Mandatory)] [ValidateRange(1, [int]::MaxValue)] [int] $KbNumber ) Invoke-MgWindowsUpdatesRequest -Method GET -Path "products/FindByKbNumber(kbNumber=$KbNumber)" } function Get-MgWindowsUpdateProductKnownIssueBeta { <# .SYNOPSIS Gets product known issues for a time range using the beta API. .DESCRIPTION Gets product known issues for a time range using the beta API. This command uses the Microsoft Graph beta endpoint; beta behavior and schemas can change without notice. Requires WindowsUpdates.Read.All or WindowsUpdates.ReadWrite.All in the active Microsoft Graph context. .PARAMETER DaysInPast Specifies the days in past. .PARAMETER IncludeAllActive Specifies the include all active. .PARAMETER ProductId Specifies the Microsoft Graph identifier of the product. .EXAMPLE PS> $daysInPast = 30 $productId = '<product-id>' Get-MgWindowsUpdateProductKnownIssueBeta ` -DaysInPast $daysInPast ` -ProductId $productId Gets product known issues for a time range using the beta API. The example requests useful identity fields and follows all pages when the endpoint supports pagination. #> [CmdletBinding()] param( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string] $ProductId, [Parameter(Mandatory)] [ValidateRange(1, 3650)] [int] $DaysInPast, [switch] $IncludeAllActive ) $include = $IncludeAllActive.IsPresent.ToString().ToLowerInvariant() $path = "products/$ProductId/GetKnownIssuesByTimeRange(" + "daysInPast=$DaysInPast,includeAllActive=$include)" Invoke-MgWindowsUpdatesRequest -Method GET -Path $path } |