Scripts/Update-OSDUpdatePackages.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#Requires -Modules OSDUpdate
#Requires -Version 5

<#
.SYNOPSIS
    Uses the OSDUpdate Module to update subdirectory OSDUpdate Packages
 
.DESCRIPTION
    Uses the OSDUpdate Module to update subdirectory OSDUpdate Packages
 
.NOTES
    Author: David Segura
    Website: osdeploy.com
    Twitter: @SeguraOSD
    Version: 20.5.28.1
#>


#======================================================================================
# Set Error Action to Silently Continue
#======================================================================================
$ErrorActionPreference = "SilentlyContinue"

#======================================================================================
# Import OSDUpdate Module
#======================================================================================
Import-Module OSDUpdate -Force

#======================================================================================
# Get all Package Subdirectories
#======================================================================================
$Packages = Get-ChildItem $PSScriptRoot -Directory | Select-Object -Property Name

#======================================================================================
# Process Package Directories
# Only directories named with a proper PackageName will be updated
#======================================================================================
foreach ($Package in $Packages) {
    Write-Host "Updating Package $($Package.Name)" -ForegroundColor Cyan
    New-OSDUpdatePackage -PackageName "$($Package.Name)" -PackagePath $PSScriptRoot -AppendPackageName -RemoveSuperseded
}