Private/OSD-Info.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
function OSD-Info-OSMedia {
    [CmdletBinding()]
    PARAM ()
    Write-Host '========================================================================================' -ForegroundColor DarkGray
    Write-Host "OSMedia Information" -ForegroundColor Green
    Write-Host "-OSMediaName: $OSMediaName" -ForegroundColor Yellow
    Write-Host "-OSMediaPath: $OSMediaPath" -ForegroundColor Yellow
    Write-Host "-OS: $OS"
    Write-Host "-WinPE: $WinPE"
    Write-Host "-Info: $Info"
    Write-Host "-Logs: $Info\logs"
}

function OSD-Info-WindowsImage {
    [CmdletBinding()]
    PARAM ()
    Write-Host '========================================================================================' -ForegroundColor DarkGray
    Write-Host "Windows Image Information" -ForegroundColor Green
    Write-Host "Source Path: $OSSourcePath"
    Write-Host "-Image File: $OSImagePath"
    Write-Host "-Image Index: $OSImageIndex"
    Write-Host "-Name: $OSImageName"
    Write-Host "-Description: $OSImageDescription"
    Write-Host "-Architecture: $OSArchitecture"
    Write-Host "-Edition: $OSEditionID"
    Write-Host "-Type: $OSInstallationType"
    Write-Host "-Languages: $OSLanguages"
    Write-Host "-Build: $OSBuild"
    Write-Host "-Version: $OSVersion"
    Write-Host "-SPBuild: $OSSPBuild"
    Write-Host "-SPLevel: $OSSPLevel"
    Write-Host "-Bootable: $OSImageBootable"
    Write-Host "-WimBoot: $OSWIMBoot"
    Write-Host "-Created Time: $OSCreatedTime"
    Write-Host "-Modified Time: $OSModifiedTime"
    Write-Host "-UBR: $UBR"
    Write-Host "-OSMGuid: $OSMGuid"
}

function OSD-Info-WorkingInformation {
    [CmdletBinding()]
    PARAM ()
    #===================================================================================================
    Write-Verbose '19.1.1 Working Information'
    #===================================================================================================
    Write-Host '========================================================================================' -ForegroundColor DarkGray
    Write-Host "Working Information" -ForegroundColor Green
    Write-Host "-WorkingName: $WorkingName" -ForegroundColor Yellow
    Write-Host "-WorkingPath: $WorkingPath" -ForegroundColor Yellow
    Write-Host "-OS: $OS"
    Write-Host "-WinPE: $WinPE"
    Write-Host "-Info: $Info"
    Write-Host "-Logs: $Info\logs"
}
function OSD-Info-SourceOSMedia {
    [CmdletBinding()]
    PARAM ()
    #===================================================================================================
    # OSD-Info-SourceOSMedia
    #===================================================================================================
    Write-Host '========================================================================================' -ForegroundColor DarkGray
    Write-Host "Source OSMedia Windows Image Information" -ForegroundColor Green
    Write-Host "-OSMedia Path: $OSMediaPath" -ForegroundColor Yellow
    Write-Host "-Image File: $OSImagePath"
    Write-Host "-Image Index: $OSImageIndex"
    Write-Host "-Name: $OSImageName"
    Write-Host "-Description: $OSImageDescription"
    Write-Host "-Architecture: $OSArchitecture"
    Write-Host "-Edition: $OSEditionID"
    Write-Host "-Type: $OSInstallationType"
    Write-Host "-Languages: $OSLanguages"
    Write-Host "-Major Version: $OSMajorVersion"
    Write-Host "-Build: $OSBuild"
    Write-Host "-Version: $OSVersion"
    Write-Host "-SPBuild: $OSSPBuild"
    Write-Host "-SPLevel: $OSSPLevel"
    Write-Host "-Bootable: $OSImageBootable"
    Write-Host "-WimBoot: $OSWIMBoot"
    Write-Host "-Created Time: $OSCreatedTime"
    Write-Host "-Modified Time: $OSModifiedTime"
}
function OSD-Info-TaskInformation {
    [CmdletBinding()]
    PARAM ()        
    #===================================================================================================
    Write-Verbose '19.1.25 OSBuild Task Information'
    #===================================================================================================
    Write-Host '========================================================================================' -ForegroundColor DarkGray
    Write-Host "OSBuild Task Information" -ForegroundColor Green
    Write-Host "-TaskName: $TaskName"
    Write-Host "-TaskVersion: $TaskVersion"
    Write-Host "-TaskType: $TaskType"
    Write-Host "-OSMedia Name: $OSMediaName"
    Write-Host "-OSMedia Path: $OSMediaPath"
    Write-Host "-Custom Name: $CustomName"
    Write-Host "-Disable Feature:"
    if ($DisableFeature) {foreach ($item in $DisableFeature)            {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-Drivers:"
    if ($Drivers) {foreach ($item in $Drivers)                          {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-Enable Feature:"
    if ($EnableFeature) {foreach ($item in $EnableFeature)              {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-Enable NetFx3: $EnableNetFX3"
    Write-Host "-Extra Files:"
    if ($ExtraFiles) {foreach ($item in $ExtraFiles)                    {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-Features On Demand:"
    if ($FeaturesOnDemand) {foreach ($item in $FeaturesOnDemand)        {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-Packages:"
    if ($Packages) {foreach ($item in $Packages)                        {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-Remove Appx:"
    if ($RemoveAppx) {foreach ($item in $RemoveAppx)                    {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-Remove Capability:"
    if ($RemoveCapability) {foreach ($item in $RemoveCapability)        {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-Remove Packages:"
    if ($RemovePackage) {foreach ($item in $RemovePackage)              {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-Scripts:"
    if ($Scripts) {foreach ($item in $Scripts)                          {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-Start Layout: $StartLayoutXML"
    Write-Host "-Unattend: $UnattendXML"
    Write-Host "-WinPE Auto ExtraFiles: $WinPEAutoExtraFiles"
    Write-Host "-WinPE DaRT: $WinPEDaRT"
    Write-Host "-WinPE Drivers:"
    if ($WinPEDrivers) {foreach ($item in $WinPEDrivers)                {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-WinPE ADK Packages:"
    if ($WinPEADKPE) {foreach ($item in $WinPEADKPE)                    {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-WinRE ADK Packages:"
    if ($WinPEADKRE) {foreach ($item in $WinPEADKRE)                    {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-WinSE ADK Packages:"
    if ($WinPEADKSE) {foreach ($item in $WinPEADKSE)                    {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-WinPE Extra Files:"
    if ($WinPEExtraFilesPE) {foreach ($item in $WinPEExtraFilesPE)      {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-WinRE Extra Files:"
    if ($WinPEExtraFilesRE) {foreach ($item in $WinPEExtraFilesRE)      {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-WinSE Extra Files:"
    if ($WinPEExtraFilesSE) {foreach ($item in $WinPEExtraFilesSE)      {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-WinPE Scripts:"
    if ($WinPEScriptsPE) {foreach ($item in $WinPEScriptsPE)            {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-WinRE Scripts:"
    if ($WinPEScriptsRE) {foreach ($item in $WinPEScriptsRE)            {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-WinSE Scripts:"
    if ($WinPEScriptsSE) {foreach ($item in $WinPEScriptsSE)            {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-SetAllIntl (Language): $SetAllIntl"
    Write-Host "-SetInputLocale (Language): $SetInputLocale"
    Write-Host "-SetSKUIntlDefaults (Language): $SetSKUIntlDefaults"
    Write-Host "-SetSetupUILang (Language): $SetSetupUILang"
    Write-Host "-SetSysLocale (Language): $SetSysLocale"
    Write-Host "-SetUILang (Language): $SetUILang"
    Write-Host "-SetUILangFallback (Language): $SetUILangFallback"
    Write-Host "-SetUserLocale (Language): $SetUserLocale"
    Write-Host "-Language Features:"
    if ($LanguageFeatures) {foreach ($item in $LanguageFeatures)        {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-Language Interface Packs:"
    if ($LanguageInterfacePacks) {foreach ($item in $LanguageInterfacePacks) {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-Language Packs:"
    if ($LanguagePacks) {foreach ($item in $LanguagePacks)              {Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-Local Experience Packs:"
    if ($LocalExperiencePacks) {foreach ($item in $LocalExperiencePacks){Write-Host $item -ForegroundColor DarkGray}}
    Write-Host "-Language Sources Copy:"
    if ($LanguageCopySources) {foreach ($item in $LanguageCopySources){Write-Host $item -ForegroundColor DarkGray}}

    $CombinedOSMedia = Get-OSMedia -Revision OK | Where-Object {$_.OSMFamily -eq $TaskOSMFamily}

    $CombinedTask = [ordered]@{
        "TaskType" = [string]"OSBuild";
        "TaskName" = [string]$TaskName;
        "TaskVersion" = [string]$TaskVersion;
        "TaskGuid" = [string]$(New-Guid);
        "CustomName" = [string]$CustomName;
        "OSMFamily" = [string]$TaskOSMFamily
        "OSMGuid" = [string]$CombinedOSMedia.OSMGuid;
        "Name" = [string]$OSMediaName;

        "ImageName" = [string]$CombinedOSMedia.ImageName;
        "Arch" = [string]$CombinedOSMedia.Arch;
        "ReleaseId" = [string]$CombinedOSMedia.ReleaseId;
        "UBR" = [string]$CombinedOSMedia.UBR;
        "Languages" = [string[]]$CombinedOSMedia.Languages;
        "EditionId" = [string]$CombinedOSMedia.EditionId;
        "InstallationType" = [string]$CombinedOSMedia.InstallationType;
        "MajorVersion" = [string]$CombinedOSMedia.MajorVersion;
        "Build" = [string]$CombinedOSMedia.Build;
        "CreatedTime" = [datetime]$CombinedOSMedia.CreatedTime;
        "ModifiedTime" = [datetime]$CombinedOSMedia.ModifiedTime;

        "EnableNetFX3" = [string]$EnableNetFX3;
        "StartLayoutXML" = [string]$StartLayoutXML;
        "UnattendXML" = [string]$UnattendXML;
        "WinPEAutoExtraFiles" = [string]$WinPEAutoExtraFiles;
        "WinPEDaRT" = [string]$WinPEDaRT;

        "ExtraFiles" = [string[]]$($ExtraFiles | Sort-Object -Unique);
        "Scripts" = [string[]]$($Scripts | Sort-Object -Unique);
        "Drivers" = [string[]]$($Drivers | Sort-Object -Unique);

        "AddWindowsPackage" = [string[]]$($Packages | Sort-Object -Unique);
        "RemoveWindowsPackage" = [string[]]$($RemovePackage | Sort-Object -Unique);
        "AddFeatureOnDemand" = [string[]]$($FeaturesOnDemand | Sort-Object -Unique);
        "EnableWindowsOptionalFeature" = [string[]]$($EnableFeature | Sort-Object -Unique);
        "DisableWindowsOptionalFeature" = [string[]]$($DisableFeature | Sort-Object -Unique);
        "RemoveAppxProvisionedPackage" = [string[]]$($RemoveAppx | Sort-Object -Unique);
        "RemoveWindowsCapability" = [string[]]$($RemoveCapability | Sort-Object -Unique);

        "WinPEDrivers" = [string[]]$($WinPEDrivers | Sort-Object -Unique);
        "WinPEExtraFilesPE" = [string[]]$($WinPEExtraFilesPE | Sort-Object -Unique);
        "WinPEExtraFilesRE" = [string[]]$($WinPEExtraFilesRE | Sort-Object -Unique);
        "WinPEExtraFilesSE" = [string[]]$($WinPEExtraFilesSE | Sort-Object -Unique);
        "WinPEScriptsPE" = [string[]]$($WinPEScriptsPE | Sort-Object -Unique);
        "WinPEScriptsRE" = [string[]]$($WinPEScriptsRE | Sort-Object -Unique);
        "WinPEScriptsSE" = [string[]]$($WinPEScriptsSE | Sort-Object -Unique);
        "WinPEADKPE" = [string[]]$($WinPEADKPE | Select-Object -Unique);
        "WinPEADKRE" = [string[]]$($WinPEADKRE | Select-Object -Unique);
        "WinPEADKSE" = [string[]]$($WinPEADKSE | Select-Object -Unique);

        "LangSetAllIntl" = [string]$SetAllIntl;
        "LangSetInputLocale" = [string]$SetInputLocale;
        "LangSetSKUIntlDefaults" = [string]$SetSKUIntlDefaults;
        "LangSetSetupUILang" = [string]$SetSetupUILang;
        "LangSetSysLocale" = [string]$SetSysLocale;
        "LangSetUILang" = [string]$SetUILang;
        "LangSetUILangFallback" = [string]$SetUILangFallback;
        "LangSetUserLocale" = [string]$SetUserLocale;
        "LanguageFeature" = [string[]]$($LanguageFeatures | Sort-Object -Unique);
        "LanguageInterfacePack" = [string[]]$($LanguageInterfacePacks | Sort-Object -Unique);
        "LanguagePack" = [string[]]$($LanguagePacks | Sort-Object -Unique);
        "LocalExperiencePacks" = [string[]]$($LocalExperiencePacks | Sort-Object -Unique);
    }
    $CombinedTask | ConvertTo-Json | Out-File "$($CombinedOSMedia.FullName)\OSBuild.json"
}