Private/OSB-Upgrade.ps1
function OSB-Upgrade-Module { [CmdletBinding()] PARAM () try { Write-Warning "Uninstall-Module -Name OSBuilder -AllVersions -Force" Uninstall-Module -Name OSBuilder -AllVersions -Force } catch {} try { Write-Warning "Install-Module -Name OSBuilder -Force" Install-Module -Name OSBuilder -Scope CurrentUser -Force } catch {} try { Write-Warning "Import-Module -Name OSBuilder -Force" Import-Module -Name OSBuilder -Force } catch {} } function OSB-Upgrade-RemoveCatalogs { [CmdletBinding()] PARAM () if (Test-Path "$CatalogLocal") { $CatalogsRemove = $(Get-Content $CatalogLocal | ConvertFrom-Json).CatalogsRemove foreach ($Catalog in $CatalogsRemove) { Get-ChildItem "$OSBuilderContent\Updates\*" -Include "$Catalog" -Recurse | foreach { Write-Warning "Removing $($_.FullName)" Remove-Item $_.FullName -Force | Out-Null } } } } |