Private/OSD-Scripts.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
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
    if ($ScriptTemplates) {
        foreach ($Script in $ScriptTemplates) {
            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
    }
}