Get-OSBuilder.ps1
function Get-OSBuilder { [CmdletBinding()] Param ( [string]$OSBuilderPath, [switch]$CreatePaths, [switch]$HideDetails ) #====================================================================================== # Check if OSMedia is installed and prompt for removal 18.9.13 #====================================================================================== if (Get-Module -ListAvailable -Name OSMedia) { Write-Warning "PowerShell Module OSMedia needs to be removed before using OSBuilder" Write-Warning "Use the following command:" Write-Warning "Uninstall-Module -Name OSMedia -AllVersions -Force" Return } #====================================================================================== # OSBuilder Version 18.9.13 #====================================================================================== $ModuleVersion = $(Get-Module -Name OSBuilder).Version if ($HideDetails -eq $false) { Write-Host "Version $ModuleVersion" -ForegroundColor Cyan Write-Host "" } #====================================================================================== # Create Empty Registry Key and Values #====================================================================================== if (!(Test-Path HKCU:\Software\OSDeploy\OSBuilder)) {New-Item HKCU:\Software\OSDeploy -Name OSBuilder -Force | Out-Null} #====================================================================================== # Set OSBuilder Path #====================================================================================== if (!(Get-ItemProperty -Path 'HKCU:\Software\OSDeploy' -Name OSBuilderPath -ErrorAction SilentlyContinue)) {New-ItemProperty -Path "HKCU:\Software\OSDeploy" -Name OSBuilderPath -Force | Out-Null} if ($OSBuilderPath) {Set-ItemProperty -Path "HKCU:\Software\OSDeploy" -Name "OSBuilderPath" -Value "$OSBuilderPath" -Force} $Script:OSBuilderPath = $(Get-ItemProperty "HKCU:\Software\OSDeploy").OSBuilderPath if (!($Script:OSBuilderPath)) {$Script:OSBuilderPath = "$Env:SystemDrive\OSBuilder"} #====================================================================================== # Set Primary Paths #====================================================================================== $Script:OSBuildsPath = "$Script:OSBuilderPath\OSBuilds" $Script:ContentPath = "$Script:OSBuilderPath\Content" $Script:OSMediaPath = "$Script:OSBuilderPath\OSMedia" #$Script:PEBuildsPath = "$Script:OSBuilderPath\PEBuilds" $Script:TasksPath = "$Script:OSBuilderPath\Tasks" #$Script:TestBuildsPath = "$Script:OSBuilderPath\TestBuilds" if ($CreatePaths.IsPresent) { if (!(Test-Path "$Script:ContentPath")) {New-Item "$Script:ContentPath" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:OSBuilderPath")) {New-Item "$Script:OSBuilderPath" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:OSBuildsPath")) {New-Item "$Script:OSBuildsPath" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:OSMediaPath")) {New-Item "$Script:OSMediaPath" -ItemType Directory -Force | Out-Null} #if (!(Test-Path "$Script:PEBuildsPath")) {New-Item "$Script:PEBuildsPath" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:TasksPath")) {New-Item "$Script:TasksPath" -ItemType Directory -Force | Out-Null} #if (!(Test-Path "$Script:TestBuildsPath")) {New-Item "$Script:TestBuildsPath" -ItemType Directory -Force | Out-Null} } #====================================================================================== # Set Content Paths #====================================================================================== $Script:DriversPath = "$Script:ContentPath\Drivers" $Script:ExtraFilesPath = "$Script:ContentPath\ExtraFiles" $Script:LanguagePacksPath = "$Script:ContentPath\LanguagePacks" $Script:MountPath = "$Script:ContentPath\Mount" $Script:PackagesPath = "$Script:ContentPath\Packages" $Script:ProvisioningPath = "$Script:ContentPath\Provisioning" $Script:ScriptsPath = "$Script:ContentPath\Scripts" $Script:StartLayoutsPath = "$Script:ContentPath\StartLayout" $Script:UnattendsPath = "$Script:ContentPath\Unattend" $Script:UpdatesPath = "$Script:ContentPath\Updates" #$Script:UpdatesCustomPath = "$Script:ContentPath\UpdatesCustom" $Script:WinPEPath = "$Script:ContentPath\WinPE" #====================================================================================== # Set Local Catalog #====================================================================================== $Script:CatalogXml = "$Script:UpdatesPath\Catalog.xml" $Script:CatalogJson = "$Script:UpdatesPath\Catalog.json" #====================================================================================== # Set Catalog URL #====================================================================================== $Script:CatalogXmlUrl = "https://raw.githubusercontent.com/OSDeploy/OSBuilder.Config/master/Updates/Catalog.xml" $Script:CatalogJsonUrl = "https://raw.githubusercontent.com/OSDeploy/OSBuilder.Config/master/Updates/Catalog.json" #====================================================================================== # Create Paths #====================================================================================== if ($CreatePaths.IsPresent) { if (!(Test-Path "$Script:DriversPath")) {New-Item "$Script:DriversPath" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:ExtraFilesPath")) {New-Item "$Script:ExtraFilesPath" -ItemType Directory -Force | Out-Null} #if (!(Test-Path "$Script:ExtraFilesPath\Win10 x64 1709")) {New-Item "$Script:ExtraFilesPath\Win10 x64 1709" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:ExtraFilesPath\Win10 x64 1803")) {New-Item "$Script:ExtraFilesPath\Win10 x64 1803" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:LanguagePacksPath")) {New-Item "$Script:LanguagePacksPath" -ItemType Directory -Force | Out-Null} #if (!(Test-Path "$Script:LanguagePacksPath\Win10 x64 1709")) {New-Item "$Script:LanguagePacksPath\Win10 x64 1709" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:LanguagePacksPath\Win10 x64 1803")) {New-Item "$Script:LanguagePacksPath\Win10 x64 1803" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:MountPath")) {New-Item "$Script:MountPath" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:PackagesPath")) {New-Item "$Script:PackagesPath" -ItemType Directory -Force | Out-Null} #if (!(Test-Path "$Script:PackagesPath\Win10 x64 1709")) {New-Item "$Script:PackagesPath\Win10 x64 1709" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:PackagesPath\Win10 x64 1803")) {New-Item "$Script:PackagesPath\Win10 x64 1803" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:ProvisioningPath")) {New-Item "$Script:ProvisioningPath" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:ScriptsPath")) {New-Item "$Script:ScriptsPath" -ItemType Directory -Force | Out-Null} #if (!(Test-Path "$Script:StacksPath")) {New-Item "$Script:StacksPath" -ItemType Directory -Force | Out-Null} #if (!(Test-Path "$Script:StacksPath\Win10 x64 1709")) {New-Item "$Script:StacksPath\Win10 x64 1709" -ItemType Directory -Force | Out-Null} #if (!(Test-Path "$Script:StacksPath\Win10 x64 1803")) {New-Item "$Script:StacksPath\Win10 x64 1803" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:StartLayoutsPath")) {New-Item "$Script:StartLayoutsPath" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:UnattendsPath")) {New-Item "$Script:UnattendsPath" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:UpdatesPath")) {New-Item "$Script:UpdatesPath" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:UpdatesPath\Adobe")) {New-Item "$Script:UpdatesPath\Adobe" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:UpdatesPath\Component")) {New-Item "$Script:UpdatesPath\Component" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:UpdatesPath\Cumulative")) {New-Item "$Script:UpdatesPath\Cumulative" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:UpdatesPath\Servicing")) {New-Item "$Script:UpdatesPath\Servicing" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:UpdatesPath\Setup")) {New-Item "$Script:UpdatesPath\Setup" -ItemType Directory -Force | Out-Null} #if (!(Test-Path "$Script:UpdatesCustomPath")) {New-Item "$Script:UpdatesCustomPath" -ItemType Directory -Force | Out-Null} #if (!(Test-Path "$Script:UpdatesPath\Win10 x64 1709")) {New-Item "$Script:UpdatesPath\Win10 x64 1709" -ItemType Directory -Force | Out-Null} #if (!(Test-Path "$Script:UpdatesPath\Win10 x64 1803")) {New-Item "$Script:UpdatesPath\Win10 x64 1803" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:WinPEPath")) {New-Item "$Script:WinPEPath" -ItemType Directory -Force | Out-Null} #if (!(Test-Path "$Script:WinPEPath\ADK\Win10 x64 1709")) {New-Item "$Script:WinPEPath\ADK\Win10 x64 1709" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:WinPEPath\ADK\Win10 x64 1803")) {New-Item "$Script:WinPEPath\ADK\Win10 x64 1803" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:WinPEPath\DaRT\DaRT 10")) {New-Item "$Script:WinPEPath\DaRT\DaRT 10" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:WinPEPath\Drivers\WinPE 10 x64")) {New-Item "$Script:WinPEPath\Drivers\WinPE 10 x64" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:WinPEPath\Drivers\WinPE 10 x86")) {New-Item "$Script:WinPEPath\Drivers\WinPE 10 x86" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:WinPEPath\ExtraFiles")) {New-Item "$Script:WinPEPath\ExtraFiles" -ItemType Directory -Force | Out-Null} if (!(Test-Path "$Script:WinPEPath\Scripts")) {New-Item "$Script:WinPEPath\Scripts" -ItemType Directory -Force | Out-Null} } #====================================================================================== # Rename Paths #====================================================================================== if (Test-Path "$Script:ExtraFilesPath\Windows 10*") {Get-ChildItem $Script:ExtraFilesPath -Directory | ForEach-Object -Process {Rename-item -Path $_.FullName -NewName ($_.Name -replace "Windows 10","Win10") -Verbose}} if (Test-Path "$Script:LanguagePacksPath\Windows 10*") {Get-ChildItem $Script:LanguagePacksPath -Directory | ForEach-Object -Process {Rename-item -Path $_.FullName -NewName ($_.Name -replace "Windows 10","Win10") -Verbose}} if (Test-Path "$Script:PackagesPath\Windows 10*") {Get-ChildItem $Script:PackagesPath -Directory | ForEach-Object -Process {Rename-item -Path $_.FullName -NewName ($_.Name -replace "Windows 10","Win10") -Verbose}} #if (Test-Path "$Script:OSBuilderPath\TestMode") {Rename-Item -Path "$Script:OSBuilderPath\TestMode" -NewName "TestBuilds" -Force} #if (Test-Path "$Script:ContentPath\ServicingStacks") {Rename-Item -Path "$Script:ContentPath\ServicingStacks" -NewName "UpdateStacks" -Force} #if (Test-Path "$Script:ContentPath\WindowsUpdates") {Rename-Item -Path "$Script:ContentPath\WindowsUpdates" -NewName "UpdateWindows" -Force} #if (Test-Path "$Script:StacksPath\Windows 10*") {Get-ChildItem $Script:StacksPath -Directory | ForEach-Object -Process {Rename-item -Path $_.FullName -NewName ($_.Name -replace "Windows 10","Win10") -Verbose}} #if (Test-Path "$Script:UpdatesPath\Windows 10*") {Get-ChildItem $Script:UpdatesPath -Directory | ForEach-Object -Process {Rename-item -Path $_.FullName -NewName ($_.Name -replace "Windows 10","Win10") -Verbose}} #====================================================================================== # Write Map #====================================================================================== if ($HideDetails -eq $false) { if (Test-Path $Script:OSBuilderPath) {Write-Host "OSBuilder: $Script:OSBuilderPath" -ForegroundColor Yellow} else {Write-Host "OSBuilder: $Script:OSBuilderPath (does not exist)" -ForegroundColor Yellow} if (Test-Path $Script:OSBuildsPath) {Write-Host "-OSBuilds: $Script:OSBuildsPath" -ForegroundColor Cyan} else {Write-Host "-OSBuilds: $Script:OSBuildsPath (does not exist)" -ForegroundColor Cyan} #if (Test-Path $Script:PEBuildsPath) {Write-Host "-PEBuilds: $Script:PEBuildsPath" -ForegroundColor Cyan} # else {Write-Host "-PEBuilds: $Script:PEBuildsPath (does not exist)" -ForegroundColor Cyan} if (Test-Path $Script:OSMediaPath) {Write-Host "-OSMedia: $Script:OSMediaPath" -ForegroundColor Cyan} else {Write-Host "-OSMedia: $Script:OSMediaPath (does not exist)" -ForegroundColor Cyan} if (Test-Path $Script:TasksPath) {Write-Host "-Tasks: $Script:TasksPath" -ForegroundColor Cyan} else {Write-Host "-Tasks: $Script:TasksPath (does not exist)" -ForegroundColor Cyan} #if (Test-Path $Script:TestBuildsPath) {Write-Host "-TestBuilds: $Script:TestBuildsPath" -ForegroundColor Cyan} # else {Write-Host "-TestBuilds: $Script:TestBuildsPath (does not exist)" -ForegroundColor Cyan} Write-Host "" if (Test-Path $Script:ContentPath) {Write-Host "Content: $Script:ContentPath" -ForegroundColor Yellow} else {Write-Host "Content: $Script:ContentPath (does not exist)" -ForegroundColor Yellow} if (Test-Path $Script:DriversPath) {Write-Host "-Drivers: $Script:DriversPath" -ForegroundColor Cyan} else {Write-Host "-Drivers: $Script:DriversPath (does not exist)" -ForegroundColor Cyan} if (Test-Path $Script:ExtraFilesPath) {Write-Host "-Extra Files: $Script:ExtraFilesPath" -ForegroundColor Cyan} else {Write-Host "-Extra Files: $Script:ExtraFilesPath (does not exist)" -ForegroundColor Cyan} if (Test-Path $Script:LanguagePacksPath){Write-Host "-Language Packs: $Script:LanguagePacksPath" -ForegroundColor Cyan} else {Write-Host "-Language Packs: $Script:LanguagePacksPath (does not exist)" -ForegroundColor Cyan} if (Test-Path $Script:MountPath) {Write-Host "-MountPath: $Script:MountPath" -ForegroundColor Cyan} else {Write-Host "-MountPath: $Script:MountPath (does not exist)" -ForegroundColor Cyan} if (Test-Path $Script:PackagesPath) {Write-Host "-Packages: $Script:PackagesPath" -ForegroundColor Cyan} else {Write-Host "-Packages: $Script:PackagesPath (does not exist)" -ForegroundColor Cyan} if (Test-Path $Script:ProvisioningPath) {Write-Host "-Provisioning: $Script:ProvisioningPath" -ForegroundColor Cyan} else {Write-Host "-Provisioning: $Script:ProvisioningPath (does not exist)" -ForegroundColor Cyan} if (Test-Path $Script:ScriptsPath) {Write-Host "-Scripts: $Script:ScriptsPath" -ForegroundColor Cyan} else {Write-Host "-Scripts: $Script:ScriptsPath (does not exist)" -ForegroundColor Cyan} if (Test-Path $Script:StartLayoutsPath) {Write-Host "-Start Layouts: $Script:StartLayoutsPath" -ForegroundColor Cyan} else {Write-Host "-Start Layouts: $Script:StartLayoutsPath (does not exist)" -ForegroundColor Cyan} if (Test-Path $Script:UnattendsPath) {Write-Host "-Unattend XML: $Script:UnattendsPath" -ForegroundColor Cyan} else {Write-Host "-Unattend XML: $Script:UnattendsPath (does not exist)" -ForegroundColor Cyan} if (Test-Path $Script:UpdatesPath) {Write-Host "-Updates: $Script:UpdatesPath" -ForegroundColor Cyan} else {Write-Host "-Updates: $Script:UpdatesPath (does not exist)" -ForegroundColor Cyan} if (Test-Path $Script:WinPEPath) {Write-Host "-WinPE Content: $Script:WinPEPath" -ForegroundColor Cyan} else {Write-Host "-WinPE Content: $Script:WinPEPath (does not exist)" -ForegroundColor Cyan} Write-Host "" } #====================================================================================== # Show Details #====================================================================================== if ($HideDetails -eq $false) { if (Test-Path $OSMediaPath) { $ListOSLibrary = Get-ChildItem -Path $OSMediaPath -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: $OSMediaPath\* (Imported Operating Systems)" -ForegroundColor Yellow if ($(Get-ChildItem -Path $OSMediaPath -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 $OSBuildsPath) { $ListOSBuilds = Get-ChildItem -Path $OSBuildsPath -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: $OSBuildsPath\* (Modified Operating Systems)" -ForegroundColor Yellow if ($(Get-ChildItem -Path $OSBuildsPath -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 $PEBuildsPath) { $ListPEBuilds = Get-ChildItem -Path $PEBuildsPath -Directory $ListPEBuilds = $ListPEBuilds | Where-Object {Test-Path "$PEBuildsPath\*\*.wim"} if (@($ListPEBuilds).Count -gt 0) { Write-Host "PEBuilds: $PEBuildsPath\* (Modified WinPE)" -ForegroundColor Yellow $($ListPEBuilds.Name) Write-Host "" } } #> if (Test-Path $TasksPath) { $ListTasks = Get-ChildItem -Path $TasksPath *.json -File | Where-Object {$_.Name -notlike "*OSMedia*"} if (@($ListTasks).Count -gt 0) { Write-Host "Tasks: $TasksPath\* (Automated Task Sequences)" -ForegroundColor Yellow $($ListTasks.BaseName) Write-Host "" } } <# if (Test-Path $TestBuildsPath) { $ListTestBuilds = Get-ChildItem -Path $TestBuildsPath -Directory if (@($ListTestBuilds).Count -gt 0) { Write-Host "Test Builds $TestBuildsPath\*" -ForegroundColor Yellow Write-Warning "Test Builds can be deleted to free space" $($ListTestBuilds.Name) Write-Host "" } } #> if (Test-Path $ScriptsPath) { $ListScripts = Get-ChildItem -Path $ScriptsPath *.ps1 -File if (@($ListScripts).Count -gt 0) { Write-Host "Scripts: $ScriptsPath\*" -ForegroundColor Yellow $($ListScripts.Name) Write-Host "" } } if (Test-Path $StartLayoutsPath) { $ListStartLayout = Get-ChildItem -Path $StartLayoutsPath *.xml -Recurse -File if (@($ListStartLayout).Count -gt 0) { Write-Host "Start Layouts: $StartLayoutsPath\*" -ForegroundColor Yellow $($ListStartLayout.Name) Write-Host "" } } if (Test-Path $UnattendsPath) { $ListUnattend = Get-ChildItem -Path $UnattendsPath *.xml -Recurse -File if (@($ListUnattend).Count -gt 0) { Write-Host "Unattend XMLs: $UnattendsPath\*" -ForegroundColor Yellow $($ListUnattend.Name) Write-Host "" } } if (Test-Path $DriversPath) { $ListDrivers = Get-ChildItem -Path "$DriversPath\*" -Directory if (@($ListDrivers).Count -gt 0) { Write-Host "Drivers: $DriversPath\*" -ForegroundColor Yellow $($ListDrivers.FullName).replace("$DriversPath\","") Write-Host "" } } if (Test-Path $ExtraFilesPath) { $ListExtraFiles = Get-ChildItem -Path $ExtraFilesPath -Directory $ListExtraFiles = $ListExtraFiles | Where-Object {(Get-ChildItem $_.FullName | Measure-Object).Count -gt 0} if (@($ListExtraFiles).Count -gt 0) { Write-Host "Windows Extra Files: $ExtraFilesPath\*" -ForegroundColor Yellow $($ListExtraFiles.Name) Write-Host "" } } if (Test-Path "$Script:WinPEPath\DaRT") { $ListWinPEDaRT = Get-ChildItem -Path "$Script:WinPEPath\DaRT" *.cab -Recurse -File if (@($ListWinPEDaRT).Count -gt 0) { Write-Host "WinPE DaRT: $Script:WinPEPath\DaRT\*" -ForegroundColor Yellow $($ListWinPEDaRT.FullName).replace("$Script:WinPEPath\DaRT\","") Write-Host "" } } if (Test-Path "$Script:WinPEPath\Drivers") { $ListWinPEDrivers = Get-ChildItem -Path "$Script:WinPEPath\Drivers\*\*" -Directory if (@($ListWinPEDrivers).Count -gt 0) { Write-Host "WinPE Drivers: $Script:WinPEPath\Drivers\*" -ForegroundColor Yellow $($ListWinPEDrivers.FullName).replace("$Script:WinPEPath\Drivers\","") Write-Host "" } } if (Test-Path $LanguagePacksPath) { $ListLanguagePacks = Get-ChildItem -Path $LanguagePacksPath -Include *.msu, *.cab -Recurse -File if (@($ListLanguagePacks).Count -gt 0) { Write-Host "Language Packs: $LanguagePacksPath\*" -ForegroundColor Yellow $($ListLanguagePacks.FullName).replace("$LanguagePacksPath\","") Write-Host "" } } if (Test-Path $PackagesPath) { $ListPackages = Get-ChildItem -Path $PackagesPath -Include *.msu, *.cab -Recurse -File if (@($ListPackages).Count -gt 0) { Write-Host "Packages: $PackagesPath\*" -ForegroundColor Yellow $($ListPackages.FullName).replace("$PackagesPath\","") Write-Host "" } } <# if (Test-Path "$UpdatesPath\Adobe") { $ListAdobeUpdates = Get-ChildItem -Path "$UpdatesPath\Adobe" -Include *.msu, *.cab -Recurse -File if (@($ListAdobeUpdates).Count -gt 0) { Write-Host "Adobe Updates: $UpdatesPath\Adobe\*" -ForegroundColor Yellow $($ListAdobeUpdates.FullName).replace("$UpdatesPath\Adobe\","") Write-Host "" } } if (Test-Path "$UpdatesPath\Component") { $ListComponentUpdates = Get-ChildItem -Path "$UpdatesPath\Component" -Include *.msu, *.cab -Recurse -File if (@($ListComponentUpdates).Count -gt 0) { Write-Host "Component Updates: $UpdatesPath\Component\*" -ForegroundColor Yellow $($ListComponentUpdates.FullName).replace("$UpdatesPath\Component\","") Write-Host "" } } if (Test-Path "$UpdatesPath\Cumulative") { $ListCumulativeUpdates = Get-ChildItem -Path "$UpdatesPath\Cumulative" -Include *.msu, *.cab -Recurse -File if (@($ListCumulativeUpdates).Count -gt 0) { Write-Host "Cumulative Updates: $UpdatesPath\Cumulative\*" -ForegroundColor Yellow $($ListCumulativeUpdates.FullName).replace("$UpdatesPath\Cumulative\","") Write-Host "" } } if (Test-Path "$UpdatesPath\Servicing") { $ListServicingUpdates = Get-ChildItem -Path "$UpdatesPath\Servicing" -Include *.msu, *.cab -Recurse -File if (@($ListServicingUpdates).Count -gt 0) { Write-Host "Servicing Updates: $UpdatesPath\Servicing\*" -ForegroundColor Yellow $($ListServicingUpdates.FullName).replace("$UpdatesPath\Servicing\","") Write-Host "" } } if (Test-Path "$UpdatesPath\Setup") { $ListSetupUpdates = Get-ChildItem -Path "$UpdatesPath\Setup" -Include *.msu, *.cab -Recurse -File if (@($ListSetupUpdates).Count -gt 0) { Write-Host "Setup Updates: $UpdatesPath\Setup\*" -ForegroundColor Yellow $($ListSetupUpdates.FullName).replace("$UpdatesPath\Setup\","") Write-Host "" } } #> } #====================================================================================== # Check for OSBuilder Module Updates #====================================================================================== if ($HideDetails -eq $false) { $url = "https://raw.githubusercontent.com/OSDeploy/OSBuilder.Config/master/OSBuilder.json" $statuscode = try {(Invoke-WebRequest -Uri $url -UseBasicParsing -DisableKeepAlive).StatusCode} catch [Net.WebException]{[int]$_.Exception.Response.StatusCode} if (!($statuscode -eq "200")) { } else { $osbuilder = @() $osbuilder = Invoke-RestMethod -Uri $url if ([System.Version]$($osbuilder.osbuilder.Module) -eq [System.Version]$ModuleVersion) { Write-Host "OSBuilder PowerShell Module: OK" -ForegroundColor Green } else { Write-Warning "OSBuilder PowerShell Module: Needs Update" Write-Host "" foreach ($line in $($osbuilder.osbuilder.ModuleInfo)) {Write-Warning $line} Write-Host "" } if (Test-Path "$Script:UpdatesPath\Catalog.json") { $updates = Get-Content -Path "$Script:UpdatesPath\Catalog.json" $updates = $updates | ConvertFrom-Json if ($($osbuilder.osbuilder.Updates) -eq $($updates.KBNumber[0])) { Write-Host "OSBuilder Microsoft Updates: OK" -ForegroundColor Green Write-Host "" } else { Write-Warning "OSBuilder Microsoft Updates: Needs Update" Write-Host "" foreach ($line in $($osbuilder.osbuilder.UpdatesInfo)) {Write-Warning $line} Write-Host "" } } else { Write-Warning "OSBuilder Microsoft Updates: Missing" Write-Warning "Get-OSBuilderUpdates can help with this problem" } foreach ($line in $($osbuilder.osbuilder.InfoMessage)) {Write-Host $line -ForegroundColor Yellow} Write-Host "" } } #====================================================================================== } |