@@ -105,7 +105,7 @@ if (!([System.Environment]::Is64BitProcess)) {
105105}
106106# endregion
107107
108- # Configure the environment
108+ # region Configure the environment
109109$ErrorActionPreference = [System.Management.Automation.ActionPreference ]::Stop
110110$InformationPreference = [System.Management.Automation.ActionPreference ]::Continue
111111$ProgressPreference = [System.Management.Automation.ActionPreference ]::SilentlyContinue
@@ -124,6 +124,7 @@ $prefs = @{
124124# Configure working path
125125if ($Path.Length -eq 0 ) { $WorkingPath = $PWD.Path } else { $WorkingPath = $Path }
126126Push-Location - Path $WorkingPath
127+ # endregion
127128
128129# region Import functions
129130$ModuleFile = $ (Join-Path - Path $PSScriptRoot - ChildPath " Install-Defaults.psm1" )
@@ -138,7 +139,7 @@ foreach ($Process in $PSProcesses) {
138139 Write-LogFile - Message " Running process: $ ( $Process.CommandLine ) "
139140}
140141
141- # Get system properties
142+ # region Get system properties
142143$Platform = Get-Platform
143144
144145$Build = ([System.Environment ]::OSVersion.Version).Build
@@ -150,15 +151,17 @@ $OSName = Get-OSName
150151
151152$DisplayVersion = Get-ChildItem - Path $WorkingPath - Include " VERSION.txt" - Recurse | Get-Content - Raw
152153Write-LogFile - Message " Script version: $DisplayVersion "
154+ # endregion
153155
154156# region Gather configs
155157$AllConfigs = @ (Get-ChildItem - Path " $WorkingPath \configs" - Include " *.All.json" - Recurse - ErrorAction " Continue" )
156158$ModelConfigs = @ (Get-ChildItem - Path " $WorkingPath \configs" - Include " *.$Model .json" - Recurse - ErrorAction " Continue" )
157159$BuildConfigs = @ (Get-ChildItem - Path " $WorkingPath \configs" - Include " *.$Build .json" - Recurse - ErrorAction " Continue" )
158160$PlatformConfigs = @ (Get-ChildItem - Path " $WorkingPath \configs" - Include " *.$Platform .json" - Recurse - ErrorAction " Continue" )
159161Write-LogFile - Message " Found: $ ( ($AllConfigs + $ModelConfigs + $BuildConfigs + $PlatformConfigs ).Count) configs"
162+ # endregion
160163
161- # Implement the settings defined in each config file
164+ # region Implement the settings defined in each config file
162165foreach ($Config in ($AllConfigs + $PlatformConfigs + $BuildConfigs + $ModelConfigs )) {
163166
164167 # Read the settings JSON
@@ -276,7 +279,7 @@ else {
276279}
277280# endregion
278281
279- # Copy the source files for use with upgrades
282+ # region Copy the source files for use with upgrades
280283if (Test-Path - Path " $FeatureUpdatePath \Install-Defaults.ps1" - PathType " Leaf" ) {
281284 Write-LogFile - Message " Skipping copy to $FeatureUpdatePath "
282285}
@@ -291,8 +294,9 @@ else {
291294 Write-LogFile - Message $_.Exception.Message - LogLevel 3
292295 }
293296}
297+ # endregion
294298
295- # Set uninstall registry value for detecting as an installed application
299+ # region Set uninstall registry value for detecting as an installed application
296300$Key = " HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
297301New-Item - Path " $Key \{$Guid }" - Type " RegistryKey" - Force - ErrorAction " Continue" | Out-Null
298302if ($PSCmdlet.ShouldProcess (" Set uninstall key values" )) {
@@ -303,6 +307,7 @@ if ($PSCmdlet.ShouldProcess("Set uninstall key values")) {
303307 Set-ItemProperty - Path " $Key \{$Guid }" - Name " SystemComponent" - Value 1 - Type " DWord" - Force - ErrorAction " Continue" | Out-Null
304308 Set-ItemProperty - Path " $Key \{$Guid }" - Name " HelpLink" - Value $HelpLink - Type " String" - Force - ErrorAction " Continue" | Out-Null
305309}
310+ # endregion
306311
307312# Write last entry to the event log and output 0 so that we don't fail image builds
308313$EndTime = (Get-Date ) - $StartTime
0 commit comments