Private/OSD-Scripts.ps1
function OSD-Scripts { [CmdletBinding()] PARAM () Write-Host '========================================================================================' -ForegroundColor DarkGray Write-Host "Install.wim: Task Scripts" -ForegroundColor Green if ($Scripts) { foreach ($Script in $Scripts) { if (Test-Path "$OSDBuilderContent\$Script") { Write-Host "PowerShell Script: $OSDBuilderContent\$Script" -ForegroundColor Green Invoke-Expression "& '$OSDBuilderContent\$Script'" } } } else { Write-Host "No Task Scripts were processed" -ForegroundColor DarkGray } Write-Host '========================================================================================' -ForegroundColor DarkGray Write-Host "Install.wim: Template Scripts" -ForegroundColor Green $AOSBScripts = @() $AOSBScripts = Get-ChildItem ("$OSDBuilderTemplates\Scripts\AutoApply\Global\*","$OSDBuilderTemplates\Scripts\AutoApply\Global $OSArchitecture\*") *.ps1 | Select-Object -Property FullName if ($ReleaseId -eq 7601) { [array]$AOSBScripts += Get-ChildItem ("$OSDBuilderTemplates\Scripts\AutoApply\Windows 7\*","$OSDBuilderTemplates\Scripts\AutoApply\Windows 7 $OSArchitecture\*") *.ps1 | Select-Object -Property FullName } else { if ($OSInstallationType -eq 'Client') { [array]$AOSBScripts += Get-ChildItem ("$OSDBuilderTemplates\Scripts\AutoApply\Windows 10\*","$OSDBuilderTemplates\Scripts\AutoApply\Windows 10 $OSArchitecture\*") *.ps1 | Select-Object -Property FullName #[array]$AOSBScripts += Get-ChildItem ("$OSDBuilderTemplates\Scripts\AutoApply\Windows 10\*","$OSDBuilderTemplates\Scripts\AutoApply\Windows 10 $OSArchitecture\*","$OSDBuilderTemplates\Scripts\AutoApply\Windows 10 $OSArchitecture $ReleaseId\*") *.ps1 | Select-Object -Property FullName } else { [array]$AOSBScripts += Get-ChildItem "$OSDBuilderTemplates\Scripts\AutoApply\Windows Server\*" *.ps1 | Select-Object -Property FullName #[array]$AOSBScripts += Get-ChildItem ("$OSDBuilderTemplates\Scripts\AutoApply\Windows Server\*","$OSDBuilderTemplates\Scripts\AutoApply\Windows Server $ReleaseId\*") *.ps1 | Select-Object -Property FullName } } if ($SkipTemplates) {$AOSBScripts = @()} if ($AOSBScripts) { foreach ($Script in $AOSBScripts) { Write-Host "$($Script.FullName)" -ForegroundColor DarkGray if (Test-Path "$($Script.FullName)") { Write-Host "PowerShell Script: $($Script.FullName)" -ForegroundColor Green Invoke-Expression "& '$($Script.FullName)'" } } } else { Write-Host "No Template Scripts were processed" -ForegroundColor DarkGray } } |