Public/New-OSDBuilderContentPack.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
<#
.SYNOPSIS
Creates an OSDBuilder ContentPack
 
.DESCRIPTION
Creates or Updates an OSDBuilder ContentPack in the ContentPack directory
 
.LINK
https://osdbuilder.osdeploy.com/module/functions/new-osdbuildercontentpack
#>

function New-OSDBuilderContentPack {
    [CmdletBinding()]
    Param (
        #Name of the ContentPack to create
        [Parameter(Position = 0, Mandatory = $true)]
        [ValidateNotNullOrEmpty()]
        [string]$Name,
        
        #Content Pack Type
        [ValidateSet('All','OS','WinPE','MultiLang')]
        [string]$ContentType = 'All'
    )

    $OSContentPack = @(
        'Media\ALL'
        'Media\x64'
        #'Media\x86'
        'OSCapability\1903 x64'
        'OSCapability\1903 x64 RSAT'
        'OSCapability\1909 x64'
        'OSCapability\1909 x64 RSAT'
        'OSDrivers\ALL'
        'OSDrivers\x64'
        #'OSDrivers\x86'
        'OSExtraFiles\ALL'
        'OSExtraFiles\ALL Subdirs'
        'OSExtraFiles\x64'
        'OSExtraFiles\x64 Subdirs'
        #'OSExtraFiles\x86'
        #'OSExtraFiles\x86 Subdirs'
        'OSPackages\1903 x64'
        'OSPackages\1909 x64'
        'OSPoshMods\ProgramFiles'
        'OSPoshMods\System'
        'OSRegistry\ALL'
        'OSRegistry\x64'
        #'OSRegistry\x86'
        'OSScripts\ALL'
        'OSScripts\x64'
        #'OSScripts\x86'
        'OSStartLayout\ALL'
        'OSStartLayout\x64'
        #'OSStartLayout\x86'
    )

    $PEContentPack = @(
        'PEADK\1903 x64'
        #'PEADK\1903 x64 WinPE'
        #'PEADK\1903 x64 WinRE'
        #'PEADK\1903 x64 WinSE'
        #'PEADK\1903 x86'
        #'PEADK\1903 x86 WinPE'
        #'PEADK\1903 x86 WinRE'
        #'PEADK\1903 x86 WinSE'
        'PEADK\1909 x64'
        #'PEADK\1909 x64 WinPE'
        #'PEADK\1909 x64 WinRE'
        #'PEADK\1909 x64 WinSE'
        #'PEADK\1909 x86'
        #'PEADK\1909 x86 WinPE'
        #'PEADK\1909 x86 WinRE'
        #'PEADK\1909 x86 WinSE'
        'PEDaRT'
        'PEDrivers\ALL'
        'PEDrivers\x64'
        #'PEDrivers\x86'
        'PEExtraFiles\ALL'
        'PEExtraFiles\ALL Subdirs'
        'PEExtraFiles\x64'
        'PEExtraFiles\x64 Subdirs'
        #'PEExtraFiles\x86'
        #'PEExtraFiles\x86 Subdirs'
        'PEPoshMods\ProgramFiles'
        'PEPoshMods\System'
        'PERegistry\ALL'
        'PERegistry\x64'
        #'PERegistry\x86'
        'PEScripts\ALL'
        'PEScripts\x64'
        #'PEScripts\x86'
    )

    $MultiLangContentPack = @(
        'OSLanguageFeatures\1903 x64'
        'OSLanguageFeatures\1909 x64'
        'OSLanguagePacks\1903 x64'
        'OSLanguagePacks\1909 x64'
        'OSLocalExperiencePacks\1903 x64'
        'OSLocalExperiencePacks\1909 x64'
        'PEADKLang\1903 x64'
        'PEADKLang\1909 x64'
    )
    #===================================================================================================
    # Get-OSDBuilder
    #===================================================================================================
    Get-OSDBuilder -HideDetails
    #===================================================================================================
    # OSContentPack
    #===================================================================================================
    if (($ContentType -eq 'All') -or ($ContentType -eq 'OS')) {
        foreach ($item in $OSContentPack) {
            if (!(Test-Path (Join-Path $SetOSDBuilderPathContentPacks "$Name\$item"))) {
                New-Item (Join-Path $SetOSDBuilderPathContentPacks "$Name\$item") -ItemType Directory -Force | Out-Null
            }
        }
    }
    #===================================================================================================
    # PEContentPack
    #===================================================================================================
    if (($ContentType -eq 'All') -or ($ContentType -eq 'WinPE')) {
        foreach ($item in $PEContentPack) {
            if (!(Test-Path (Join-Path $SetOSDBuilderPathContentPacks "$Name\$item"))) {
                New-Item (Join-Path $SetOSDBuilderPathContentPacks "$Name\$item") -ItemType Directory -Force | Out-Null
            }
        }
    }
    #===================================================================================================
    # MultiLangContentPack
    #===================================================================================================
    if (($ContentType -eq 'All') -or ($ContentType -eq 'MultiLang')) {
        foreach ($item in $MultiLangContentPack) {
            if (!(Test-Path (Join-Path $SetOSDBuilderPathContentPacks "$Name\$item"))) {
                New-Item (Join-Path $SetOSDBuilderPathContentPacks "$Name\$item") -ItemType Directory -Force | Out-Null
            }
        }
    }
}