Public/Get-OSBuilder.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
<#
.SYNOPSIS
Offline Servicing for Windows 10, Windows Server 2016 and Windows Server 2019

.DESCRIPTION
OSBuilder is used to Update and Configure Windows 10, Windows Server 2016, and Windows Server 2019 using Offline Servicing

.PARAMETER CreatePaths
Creates empty directories used by OSBuilder

.PARAMETER HideDetails
Hides Write-Host output. Used when called from other functions

.PARAMETER SetPath
Changes the path from the default of C:\OSBuilder to the path specified

.EXAMPLE
Get-OSBuilder -SetPath D:\OSBuilder
Sets the OSBuilder home directory to D:\OSBuilder

.EXAMPLE
Get-OSBuilder -CreatePaths
Creates empty directories used by OSBuilder
#>


function Get-OSBuilder {
    [CmdletBinding()]
    Param (
        [switch]$CreatePaths,
        [switch]$HideDetails,
        [string]$SetPath
    )
    #==============================================================================================================
    # Check if OSMedia is installed and prompt for removal 18.10.2
    #==============================================================================================================
    Get-OSMediaModule
    #==============================================================================================================
    # OSBuilder Version 18.10.2
    #==============================================================================================================
    $global:OSBuilderVersion = $(Get-Module -Name OSBuilder).Version
    if ($HideDetails -eq $false) {
        Write-Host "OSBuilder $OSBuilderVersion" -ForegroundColor Cyan
        Write-Host ""
    }
    #==============================================================================================================
    # Create Empty Registry Key and Values 18.10.1
    #==============================================================================================================
    if (!(Test-Path HKCU:\Software\OSDeploy\OSBuilder)) {New-Item HKCU:\Software\OSDeploy -Name OSBuilder -Force | Out-Null}
    #==============================================================================================================
    # Set Global OSBuilder Path 18.10.1
    #==============================================================================================================
    if (!(Get-ItemProperty -Path 'HKCU:\Software\OSDeploy' -Name OSBuilderPath -ErrorAction SilentlyContinue)) {New-ItemProperty -Path "HKCU:\Software\OSDeploy" -Name OSBuilderPath -Force | Out-Null}
    if ($SetPath) {Set-ItemProperty -Path "HKCU:\Software\OSDeploy" -Name "OSBuilderPath" -Value "$SetPath" -Force}
    $global:OSBuilderPath = $(Get-ItemProperty "HKCU:\Software\OSDeploy").OSBuilderPath
    if (!($OSBuilderPath)) {$global:OSBuilderPath = "$Env:SystemDrive\OSBuilder"}
    #==============================================================================================================
    # Set Primary Paths 18.10.1
    #==============================================================================================================
    $global:OSBuilderContent = "$OSBuilderPath\Content"
    $global:OSBuilderOSBuilds = "$OSBuilderPath\OSBuilds"
    $global:OSBuilderOSMedia = "$OSBuilderPath\OSMedia"
    $global:OSBuilderPEBuilds = "$OSBuilderPath\PEBuilds"
    $global:OSBuilderTasks = "$OSBuilderPath\Tasks"
    #==============================================================================================================
    # Set Local Catalog 18.10.1
    #==============================================================================================================
    $Script:CatalogLocal = "$OSBuilderContent\Updates\Cat.json"
    if (Test-Path "$CatalogLocal") {$OSBuilderCatalogVersion = $(Get-Content $CatalogLocal | ConvertFrom-Json).Version}
    #==============================================================================================================
    # OSBuilder URLs 18.10.2
    #==============================================================================================================
    $global:OSBuilderURL = "https://raw.githubusercontent.com/OSDeploy/OSBuilder.Public/master/OSBuilder.json"
    $global:OSBuilderCatalogURL = "https://raw.githubusercontent.com/OSDeploy/OSBuilder.Public/master/Content/Updates/Cat.json"
    #==============================================================================================================
    # Create Paths 18.10.1
    #==============================================================================================================
    if ($CreatePaths.IsPresent) {
        if (!(Test-Path "$OSBuilderPath"))                                  {New-Item "$OSBuilderPath" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderOSBuilds"))                              {New-Item "$OSBuilderOSBuilds" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderOSMedia"))                               {New-Item "$OSBuilderOSMedia" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderPEBuilds"))                              {New-Item "$OSBuilderPEBuilds" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderTasks"))                                 {New-Item "$OSBuilderTasks" -ItemType Directory -Force | Out-Null}

        if (!(Test-Path "$OSBuilderContent"))                               {New-Item "$OSBuilderContent" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderContent\Drivers"))                       {New-Item "$OSBuilderContent\Drivers" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderContent\ExtraFiles"))                    {New-Item "$OSBuilderContent\ExtraFiles" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderContent\ExtraFiles\Win10 x64 1809"))     {New-Item "$OSBuilderContent\ExtraFiles\Win10 x64 1809" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderContent\Mount"))                         {New-Item "$OSBuilderContent\Mount" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderContent\IsoExtract"))                    {New-Item "$OSBuilderContent\IsoExtract" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderContent\LanguagePacks"))                 {New-Item "$OSBuilderContent\LanguagePacks" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderContent\Packages"))                      {New-Item "$OSBuilderContent\Packages" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderContent\Packages\Win10 x64 1809"))       {New-Item "$OSBuilderContent\Packages\Win10 x64 1809" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderContent\Provisioning"))                  {New-Item "$OSBuilderContent\Provisioning" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderContent\Scripts"))                       {New-Item "$OSBuilderContent\Scripts" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderContent\StartLayout"))                   {New-Item "$OSBuilderContent\StartLayout" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderContent\Unattend"))                      {New-Item "$OSBuilderContent\Unattend" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderContent\Updates"))                       {New-Item "$OSBuilderContent\Updates" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderContent\Updates\Custom"))                {New-Item "$OSBuilderContent\Updates\Custom" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderContent\WinPE"))                         {New-Item "$OSBuilderContent\WinPE" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderContent\WinPE\ADK\Win10 x64 1809"))      {New-Item "$OSBuilderContent\WinPE\ADK\Win10 x64 1809" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderContent\WinPE\DaRT\DaRT 10"))            {New-Item "$OSBuilderContent\WinPE\DaRT\DaRT 10" -ItemType Directory -Force | Out-Null}
<# if (!(Test-Path "$OSBuilderContent\WinPE\Drivers\WinPE 10 x64")) {New-Item "$OSBuilderContent\WinPE\Drivers\WinPE 10 x64" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderContent\WinPE\Drivers\WinPE 10 x86")) {New-Item "$OSBuilderContent\WinPE\Drivers\WinPE 10 x86" -ItemType Directory -Force | Out-Null} #>

        if (!(Test-Path "$OSBuilderContent\WinPE\ExtraFiles"))              {New-Item "$OSBuilderContent\WinPE\ExtraFiles" -ItemType Directory -Force | Out-Null}
        if (!(Test-Path "$OSBuilderContent\WinPE\Scripts"))                 {New-Item "$OSBuilderContent\WinPE\Scripts" -ItemType Directory -Force | Out-Null}
    }
    #==============================================================================================================
    # Remove Old Updates 18.10.1
    #==============================================================================================================
    if (Test-Path "$OSBuilderContent\UpdateStacks")     {Write-Warning "Directory '$OSBuilderContent\UpdateStacks' is no longer required and can be removed"}
    if (Test-Path "$OSBuilderContent\UpdateWindows")    {Write-Warning "Directory '$OSBuilderContent\UpdateWindows' is no longer required and can be removed"}
    #==============================================================================================================
    # Write Map 18.10.1
    #==============================================================================================================
    if ($HideDetails -eq $false) {
        if (Test-Path $OSBuilderPath)                   {Write-Host "OSBuilder: $OSBuilderPath" -ForegroundColor Cyan}
            else                                        {Write-Host "OSBuilder: $OSBuilderPath (does not exist)" -ForegroundColor Cyan}
        if (Test-Path $OSBuilderOSBuilds)               {Write-Host "-OSBuilds: $OSBuilderOSBuilds" -ForegroundColor Cyan}
            else                                        {Write-Host "-OSBuilds: $OSBuilderOSBuilds (does not exist)" -ForegroundColor Cyan}
        if (Test-Path $OSBuilderOSMedia)                {Write-Host "-OSMedia: $OSBuilderOSMedia" -ForegroundColor Cyan}
            else                                        {Write-Host "-OSMedia: $OSBuilderOSMedia (does not exist)" -ForegroundColor Cyan}
        if (Test-Path $OSBuilderPEBuilds)               {Write-Host "-PEBuilds: $OSBuilderPEBuilds" -ForegroundColor Cyan}
            else                                        {Write-Host "-PEBuilds: $OSBuilderPEBuilds (does not exist)" -ForegroundColor Cyan}
        if (Test-Path $OSBuilderTasks)                  {Write-Host "-Tasks: $OSBuilderTasks" -ForegroundColor Cyan}
            else                                        {Write-Host "-Tasks: $OSBuilderTasks (does not exist)" -ForegroundColor Cyan}
        Write-Host ""
        if (Test-Path $OSBuilderContent)                {Write-Host "Content: $OSBuilderContent" -ForegroundColor Cyan}
            else                                        {Write-Host "Content: $OSBuilderContent (does not exist)" -ForegroundColor Cyan}
        if (Test-Path $OSBuilderContent\Drivers)        {Write-Host "-Drivers: $OSBuilderContent\Drivers" -ForegroundColor Cyan}
            else                                        {Write-Host "-Drivers: $OSBuilderContent\Drivers (does not exist)" -ForegroundColor Cyan}
        if (Test-Path $OSBuilderContent\ExtraFiles)     {Write-Host "-Extra Files: $OSBuilderContent\ExtraFiles" -ForegroundColor Cyan}
            else                                        {Write-Host "-Extra Files: $OSBuilderContent\ExtraFiles (does not exist)" -ForegroundColor Cyan}
        if (Test-Path $OSBuilderContent\Mount)          {Write-Host "-MountPath: $OSBuilderContent\Mount" -ForegroundColor Cyan}
            else                                        {Write-Host "-MountPath: $OSBuilderContent\Mount (does not exist)" -ForegroundColor Cyan}
        if (Test-Path $OSBuilderContent\Packages)       {Write-Host "-Packages: $OSBuilderContent\Packages" -ForegroundColor Cyan}
            else                                        {Write-Host "-Packages: $OSBuilderContent\Packages (does not exist)" -ForegroundColor Cyan}
        if (Test-Path $OSBuilderContent\Provisioning)   {Write-Host "-Provisioning: $OSBuilderContent\Provisioning" -ForegroundColor Cyan}
            else                                        {Write-Host "-Provisioning: $OSBuilderContent\Provisioning (does not exist)" -ForegroundColor Cyan}
        if (Test-Path $OSBuilderContent\Scripts)        {Write-Host "-Scripts: $OSBuilderContent\Scripts" -ForegroundColor Cyan}
            else                                        {Write-Host "-Scripts: $OSBuilderContent\Scripts (does not exist)" -ForegroundColor Cyan}
        if (Test-Path $OSBuilderContent\StartLayout)    {Write-Host "-Start Layouts: $OSBuilderContent\StartLayout" -ForegroundColor Cyan}
            else                                        {Write-Host "-Start Layouts: $OSBuilderContent\StartLayout (does not exist)" -ForegroundColor Cyan}
        if (Test-Path $OSBuilderContent\Unattend)       {Write-Host "-Unattend XML: $OSBuilderContent\Unattend" -ForegroundColor Cyan}
            else                                        {Write-Host "-Unattend XML: $OSBuilderContent\Unattend (does not exist)" -ForegroundColor Cyan}
        if (Test-Path $OSBuilderContent\Updates)        {Write-Host "-Updates: $OSBuilderContent\Updates" -ForegroundColor Cyan}
            else                                        {Write-Host "-Updates: $OSBuilderContent\Updates (does not exist)" -ForegroundColor Cyan}
        if (Test-Path $OSBuilderContent\WinPE)          {Write-Host "-WinPE Content: $OSBuilderContent\WinPE" -ForegroundColor Cyan}
            else                                        {Write-Host "-WinPE Content: $OSBuilderContent\WinPE (does not exist)" -ForegroundColor Cyan}
        Write-Host ""
    }
    #==============================================================================================================
    # Show Details 18.10.1
    #==============================================================================================================
    if ($HideDetails -eq $false) {
        if (Test-Path $OSBuilderOSMedia) {
            $ListOSLibrary = Get-ChildItem -Path $OSBuilderOSMedia -Directory
            $ListOSLibrary = $ListOSLibrary | Where-Object {$_.Name -like "*.*"}
            $ListOSLibrary = $ListOSLibrary | Where-Object {Test-Path $(Join-Path $_.FullName (Join-Path 'OS' (Join-Path "sources" "install.wim")))}
            $ListOSLibrary = $ListOSLibrary | Where-Object {$_.Name -notlike "*Archive*"}
            if (@($ListOSLibrary).Count -gt 0) {
                Write-Host "OSMedia: $OSBuilderOSMedia\* (Imported Operating Systems)" -ForegroundColor Cyan
                if ($(Get-ChildItem -Path $OSBuilderOSMedia -Directory | Where-Object {$_.Name -notlike "*.*" -and $_.Name -notlike "*Archive*"})) {
                    Write-Warning "One or more directories does not have a valid UBR at the end of the OSMedia Name"
                    Write-Warning "They are excluded from this list and from OSMedia Selection"
                    Write-Warning "The UBR at the end of the Name is required for functions related to versioning"
                }
                $($ListOSLibrary.Name)
                Write-Host ""
            }
        }
        if (Test-Path $OSBuilderOSBuilds) {
            $ListOSBuilds = Get-ChildItem -Path $OSBuilderOSBuilds -Directory
            $ListOSBuilds = $ListOSBuilds | Where-Object {$_.Name -like "*.*"}
            $ListOSBuilds = $ListOSBuilds | Where-Object {Test-Path $(Join-Path $_.FullName (Join-Path 'OS' (Join-Path "sources" "install.wim")))}
            if (@($ListOSBuilds).Count -gt 0) {
                Write-Host "OSBuilds: $OSBuilderOSBuilds\* (Modified Operating Systems)" -ForegroundColor Cyan
                if ($(Get-ChildItem -Path $OSBuilderOSBuilds -Directory | Where-Object {$_.Name -notlike "*.*" -and $_.Name -notlike "*Archive*"})) {
                    Write-Warning "One or more directories does not have a valid UBR at the end of the OSBuild Name"
                    Write-Warning "They are excluded from this list and from OSBuild Selection"
                    Write-Warning "The UBR at the end of the Name is required for functions related to versioning"
                }
                $($ListOSBuilds.Name)
                Write-Host ""
            }
        }
        if (Test-Path $OSBuilderPEBuilds) {
            $ListPEBuilds = Get-ChildItem -Path $OSBuilderPEBuilds -Directory
            $ListPEBuilds = $ListPEBuilds | Where-Object {$_.Name -like "*.*"}
            $ListPEBuilds = $ListPEBuilds | Where-Object {Test-Path $(Join-Path $_.FullName (Join-Path 'OS' (Join-Path "sources" "install.wim")))}
            if (@($ListPEBuilds).Count -gt 0) {
                Write-Host "OSBuilds: $OSBuilderOSBuilds\* (Modified Operating Systems)" -ForegroundColor Cyan
                if ($(Get-ChildItem -Path $OSBuilderOSBuilds -Directory | Where-Object {$_.Name -notlike "*.*" -and $_.Name -notlike "*Archive*"})) {
                    Write-Warning "One or more directories does not have a valid UBR at the end of the OSBuild Name"
                    Write-Warning "They are excluded from this list and from OSBuild Selection"
                    Write-Warning "The UBR at the end of the Name is required for functions related to versioning"
                }
                $($ListPEBuilds.Name)
                Write-Host ""
            }
        }
        if (Test-Path $OSBuilderTasks) {
            $ListTasks = Get-ChildItem -Path $OSBuilderTasks *.json -File | Where-Object {$_.Name -notlike "*OSMedia*"}
            if (@($ListTasks).Count -gt 0) {
                Write-Host "Tasks: $OSBuilderTasks\* (Automated Task Sequences)" -ForegroundColor Cyan
                $($ListTasks.BaseName)
                Write-Host ""
            }
        }
        if (Test-Path $OSBuilderContent\Scripts) {
            $ListScripts = Get-ChildItem -Path $OSBuilderContent\Scripts *.ps1 -File
            if (@($ListScripts).Count -gt 0) {
                Write-Host "Scripts: $OSBuilderContent\Scripts\*" -ForegroundColor Cyan
                $($ListScripts.Name)
                Write-Host ""
            }
        }
        if (Test-Path $OSBuilderContent\StartLayout) {
            $ListStartLayout = Get-ChildItem -Path $OSBuilderContent\StartLayout *.xml -File
            if (@($ListStartLayout).Count -gt 0) {
                Write-Host "Start Layouts: $OSBuilderContent\StartLayout\*" -ForegroundColor Cyan
                $($ListStartLayout.Name)
                Write-Host ""
            }
        }
        if (Test-Path $OSBuilderContent\Unattend) {
            $ListUnattend = Get-ChildItem -Path $OSBuilderContent\Unattend *.xml -File
            if (@($ListUnattend).Count -gt 0) {
                Write-Host "Unattend XMLs: $OSBuilderContent\Unattend\*" -ForegroundColor Cyan
                $($ListUnattend.Name)
                Write-Host ""
            }
        }
        if (Test-Path $OSBuilderContent\Drivers) {
            $ListDrivers = Get-ChildItem -Path "$OSBuilderContent\Drivers\*" -Directory
            if (@($ListDrivers).Count -gt 0) {
                Write-Host "Drivers: $OSBuilderContent\Drivers\*" -ForegroundColor Cyan
                $($ListDrivers.FullName).replace("$OSBuilderContent\Drivers\","")
                Write-Host ""
            }
        }
        if (Test-Path $OSBuilderContent\ExtraFiles) {
            $ListExtraFiles = Get-ChildItem -Path $OSBuilderContent\ExtraFiles -Directory
            $ListExtraFiles = $ListExtraFiles | Where-Object {(Get-ChildItem $_.FullName | Measure-Object).Count -gt 0}
            if (@($ListExtraFiles).Count -gt 0) {
                Write-Host "Windows Extra Files: $OSBuilderContent\ExtraFiles\*" -ForegroundColor Cyan
                $($ListExtraFiles.Name)
                Write-Host ""
            }
        }
        if (Test-Path "$OSBuilderContent\WinPE\DaRT") {
            $ListWinPEDaRT = Get-ChildItem -Path "$OSBuilderContent\WinPE\DaRT" *.cab -Recurse -File
            if (@($ListWinPEDaRT).Count -gt 0) {
                Write-Host "WinPE DaRT: $OSBuilderContent\WinPE\DaRT\*" -ForegroundColor Cyan
                $($ListWinPEDaRT.FullName).replace("$OSBuilderContent\WinPE\DaRT\","")
                Write-Host ""
            }
        }
        if (Test-Path "$OSBuilderContent\WinPE\Drivers") {
            $ListWinPEDrivers = Get-ChildItem -Path "$OSBuilderContent\WinPE\Drivers\*\*" -Directory
            if (@($ListWinPEDrivers).Count -gt 0) {
                Write-Host "WinPE Drivers: $OSBuilderContent\WinPE\Drivers\*" -ForegroundColor Cyan
                $($ListWinPEDrivers.FullName).replace("$OSBuilderContent\WinPE\Drivers\","")
                Write-Host ""
            }
        }
<# if (Test-Path "$OSBuilderContent\WinPE\Wallpaper") {
            $ListWinPEWallpaper = Get-ChildItem -Path "$OSBuilderContent\WinPE\Wallpaper" *.jpg -Recurse -File
            if (@($ListWinPEWallpaper).Count -gt 0) {
                Write-Host "WinPE Wallpaper: $OSBuilderContent\WinPE\Wallpaper\*" -ForegroundColor Cyan
                $($ListWinPEWallpaper.FullName).replace("$OSBuilderContent\WinPE\Wallpaper\","")
                Write-Host ""
            }
        } #>

        if (Test-Path $OSBuilderContent\Packages) {
            $ListPackages = Get-ChildItem -Path $OSBuilderContent\Packages -Include *.msu, *.cab -Recurse -File
            if (@($ListPackages).Count -gt 0) {
                Write-Host "Packages: $OSBuilderContent\Packages\*" -ForegroundColor Cyan
                $($ListPackages.FullName).replace("$OSBuilderContent\Packages\","")
                Write-Host ""
            }
        }
        if (Test-Path $OSBuilderContent\Provisioning) {
            $ListPackages = Get-ChildItem -Path $OSBuilderContent\Provisioning -Include *.ppkg, -Recurse -File
            if (@($ListPackages).Count -gt 0) {
                Write-Host "Provisioning: $OSBuilderContent\Provisioning\*" -ForegroundColor Cyan
                $($ListPackages.FullName).replace("$OSBuilderContent\Provisioning\","")
                Write-Host ""
            }
        }
<#         if (Test-Path "$OSBuilderContent\Updates\Adobe") {
            $ListAdobeUpdates = Get-ChildItem -Path "$OSBuilderContent\Updates\Adobe" -Include *.msu, *.cab -Recurse -File
            if (@($ListAdobeUpdates).Count -gt 0) {
                Write-Host "Adobe Updates: $OSBuilderContent\Updates\Adobe\*" -ForegroundColor Cyan
                $($ListAdobeUpdates.FullName).replace("$OSBuilderContent\Updates\Adobe\","")
                Write-Host ""
            }
        }
        if (Test-Path "$OSBuilderContent\Updates\Component") {
            $ListComponentUpdates = Get-ChildItem -Path "$OSBuilderContent\Updates\Component" -Include *.msu, *.cab -Recurse -File
            if (@($ListComponentUpdates).Count -gt 0) {
                Write-Host "Component Updates: $OSBuilderContent\Updates\Component\*" -ForegroundColor Cyan
                $($ListComponentUpdates.FullName).replace("$OSBuilderContent\Updates\Component\","")
                Write-Host ""
            }
        }
        if (Test-Path "$OSBuilderContent\Updates\Cumulative") {
            $ListCumulativeUpdates = Get-ChildItem -Path "$OSBuilderContent\Updates\Cumulative" -Include *.msu, *.cab -Recurse -File
            if (@($ListCumulativeUpdates).Count -gt 0) {
                Write-Host "Cumulative Updates: $OSBuilderContent\Updates\Cumulative\*" -ForegroundColor Cyan
                $($ListCumulativeUpdates.FullName).replace("$OSBuilderContent\Updates\Cumulative\","")
                Write-Host ""
            }
        }
        if (Test-Path "$OSBuilderContent\Updates\Servicing") {
            $ListServicingUpdates = Get-ChildItem -Path "$OSBuilderContent\Updates\Servicing" -Include *.msu, *.cab -Recurse -File
            if (@($ListServicingUpdates).Count -gt 0) {
                Write-Host "Servicing Updates: $OSBuilderContent\Updates\Servicing\*" -ForegroundColor Cyan
                $($ListServicingUpdates.FullName).replace("$OSBuilderContent\Updates\Servicing\","")
                Write-Host ""
            }
        }
        if (Test-Path "$OSBuilderContent\Updates\Setup") {
            $ListSetupUpdates = Get-ChildItem -Path "$OSBuilderContent\Updates\Setup" -Include *.msu, *.cab -Recurse -File
            if (@($ListSetupUpdates).Count -gt 0) {
                Write-Host "Setup Updates: $OSBuilderContent\Updates\Setup\*" -ForegroundColor Cyan
                $($ListSetupUpdates.FullName).replace("$OSBuilderContent\Updates\Setup\","")
                Write-Host ""
            }
        } #>

    }
    #==============================================================================================================
    # 18.20.22 OSBuilder Module
    #==============================================================================================================
    if ($HideDetails -eq $false) {
        $statuscode = try {(Invoke-WebRequest -Uri $OSBuilderURL -UseBasicParsing -DisableKeepAlive).StatusCode}
        catch [Net.WebException]{[int]$_.Exception.Response.StatusCode}
        if (!($statuscode -eq "200")) {
        } else {
            $LatestModuleVersion = @()
            $LatestModuleVersion = Invoke-RestMethod -Uri $OSBuilderURL
            foreach ($line in $($LatestModuleVersion.News)) {Write-Host $line -ForegroundColor Green}
            Write-Host ""

            if ([System.Version]$($LatestModuleVersion.Version) -eq [System.Version]$OSBuilderVersion) {
                Write-Host "OSBuilder Module: OK" -ForegroundColor Green
            } else {
                Write-Warning "OSBuilder Module Update Available"
                Write-Warning "Installed Version: $OSBuilderVersion"
                Write-Warning "Latest Version: $($LatestModuleVersion.Version) (PowerShell Gallery)"
                Write-Host ""
                foreach ($line in $($LatestModuleVersion.Info)) {Write-Host $line -ForegroundColor Green}
                Write-Host ""
            }
        }
    }
    #==============================================================================================================
    # 18.20.22 OSBuilder Updates
    #==============================================================================================================
    if ($HideDetails -eq $false) {
        $statuscode = try {(Invoke-WebRequest -Uri $OSBuilderCatalogURL -UseBasicParsing -DisableKeepAlive).StatusCode}
        catch [Net.WebException]{[int]$_.Exception.Response.StatusCode}
        if (!($statuscode -eq "200")) {
        } else {
            $LatestUpdateVersion = @()
            $LatestUpdateVersion = Invoke-RestMethod -Uri $OSBuilderCatalogURL
            if ([System.Version]$($LatestUpdateVersion.Version) -eq [System.Version]$OSBuilderCatalogVersion) {
                Write-Host "OSBuilder Update Catalogs: OK" -ForegroundColor Green
            } else {
                Write-Warning "OSBuilder Catalog Update Available"
                Write-Warning "Installed Version: $OSBuilderCatalogVersion"
                Write-Warning "Latest Version: $($LatestUpdateVersion.Version) (GitHub)"
                Write-Host ""
                foreach ($line in $($LatestUpdateVersion.Info)) {Write-Host $line -ForegroundColor Green}
                Write-Host ""
            }
        }
    }
}