Public/New-OSBUpdate.ps1
function New-OSBUpdate { [CmdletBinding()] Param ( [Parameter(Mandatory)] [ValidateSet('Adobe','Component','Cumulative','Servicing','Setup')] [string]$Category, [Parameter(Mandatory)] [int]$KBNumber, [Parameter(Mandatory)] [ValidateSet('Windows 10','Windows Server 2016','Windows Server 2019')] [string]$OS, [Parameter(Mandatory)] [ValidateSet('x64','x86')] [string]$OSArch, [Parameter(Mandatory)] [ValidateSet('1507','1511','1607','1703','1709','1803','1809')] [string]$OSBuild, [Parameter(Mandatory)] [ValidateSet('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31')] [string]$ReleaseDay, [Parameter(Mandatory)] [ValidateSet('01','02','03','04','05','06','07','08','09','10','11','12')] [string]$ReleaseMonth, [Parameter(Mandatory)] [ValidateSet('2019','2018','2017','2016','2015')] [string]$ReleaseYear, [Parameter(Mandatory)] [string]$URL ) #============================================================================================================== # 18.12.05 Initialize OSBuilder #============================================================================================================== Get-OSBuilder -CreatePaths -HideDetails #============================================================================================================== # 18.12.05 Build Date #============================================================================================================== $ReleaseDate = [datetime]::ParseExact("$ReleaseDay/$ReleaseMonth/$ReleaseYear", "dd/MM/yyyy", $null) #============================================================================================================== # 18.12.05 Create Update Object #============================================================================================================== $OSBUpdate = New-Object PSObject Add-Member -InputObject $OSBUpdate -MemberType NoteProperty -Name Category -Value "$Category" Add-Member -InputObject $OSBUpdate -MemberType NoteProperty -Name KBNumber -Value "$KBNumber" Add-Member -InputObject $OSBUpdate -MemberType NoteProperty -Name KBTitle -Value "$ReleaseYear-$ReleaseMonth Custom $Category $OS $OSBuild $OSArch KB$KBNumber" Add-Member -InputObject $OSBUpdate -MemberType NoteProperty -Name KBUrl -Value "http://support.microsoft.com/help/$KBNumber" Add-Member -InputObject $OSBUpdate -MemberType NoteProperty -Name Severity -Value "Custom" Add-Member -InputObject $OSBUpdate -MemberType NoteProperty -Name DatePosted -Value "$(($ReleaseDate).ToString())" Add-Member -InputObject $OSBUpdate -MemberType NoteProperty -Name DateRevised -Value "$(($ReleaseDate).ToString())" Add-Member -InputObject $OSBUpdate -MemberType NoteProperty -Name DateCreated -Value "$(($ReleaseDate).ToString())" Add-Member -InputObject $OSBUpdate -MemberType NoteProperty -Name DateLastModified -Value "$(($ReleaseDate).ToString())" Add-Member -InputObject $OSBUpdate -MemberType NoteProperty -Name FileName -Value "$(Split-Path $URL -Leaf)" Add-Member -InputObject $OSBUpdate -MemberType NoteProperty -Name URL -Value "$URL" #============================================================================================================== # 18.12.03 Create Update Catalog #============================================================================================================== $OSBUpdate | Export-Clixml -Path "$OSBuilderContent\Updates\$Category\Cat $ReleaseYear-$ReleaseMonth Custom $Category $OS $OSBuild $OSArch KB$KBNumber.xml" } |