@@ -122,11 +122,17 @@ function Invoke-MicrowinGetIso {
122122 Set-WinUtilTaskbaritem - state " Indeterminate" - overlay " logo"
123123 Invoke-MicrowinBusyInfo - action " wip" - message " Checking system requirements..." - interactive $false
124124
125+ $adkKitsRoot = Microwin- GetKitsRoot - wow64environment $false
126+ $adkKitsRoot_WOW64Environ = Microwin- GetKitsRoot - wow64environment $true
127+
128+ $expectedADKPath = " $ ( $adkKitsRoot ) Assessment and Deployment Kit"
129+ $expectedADKPath_WOW64Environ = " $ ( $adkKitsRoot_WOW64Environ ) Assessment and Deployment Kit"
130+
125131 $oscdimgPath = Join-Path $env: TEMP ' oscdimg.exe'
126- $oscdImgFound = [bool ] (Get-Command - ErrorAction Ignore - Type Application oscdimg.exe ) -or (Test-Path $oscdimgPath - PathType Leaf)
132+ $oscdImgFound = [bool ] (Microwin - TestKitsRootPaths - adkKitsRootPath " $expectedADKPath " - adkKitsRootPath_WOW64Environ " $expectedADKPath_WOW64Environ " ) -or (Test-Path $oscdimgPath - PathType Leaf)
127133 Write-Host " oscdimg.exe on system: $oscdImgFound "
128134
129- if (! $oscdImgFound ) {
135+ if (-not ( $oscdImgFound ) ) {
130136 $downloadFromGitHub = $sync.WPFMicrowinDownloadFromGitHub.IsChecked
131137
132138 if (! $downloadFromGitHub ) {
@@ -162,6 +168,30 @@ function Invoke-MicrowinGetIso {
162168 Write-Host " oscdimg.exe was successfully downloaded from github"
163169 }
164170 }
171+ } elseif (Microwin- TestKitsRootPaths - adkKitsRootPath " $expectedADKPath " - adkKitsRootPath_WOW64Environ " $expectedADKPath_WOW64Environ " ) {
172+ # We have to guess where oscdimg is. We'll check both values...
173+ $peToolsPath = " "
174+
175+ if ($expectedADKPath -ne " Assessment and Deployment Kit" ) { $peToolsPath = $expectedADKPath }
176+ if (($peToolsPath -eq " " ) -and ($expectedADKPath_WOW64Environ -ne " Assessment and Deployment Kit" )) { $peToolsPath = $expectedADKPath_WOW64Environ }
177+
178+ Write-Host " Using $peToolsPath as the Preinstallation Environment tools path..."
179+ # Paths change depending on platform
180+ if ([Environment ]::Is64BitOperatingSystem) {
181+ $oscdimgPath = " $peToolsPath \Deployment Tools\amd64\Oscdimg\oscdimg.exe"
182+ } else {
183+ $oscdimgPath = " $peToolsPath \Deployment Tools\x86\Oscdimg\oscdimg.exe"
184+ }
185+
186+ # If it's a non-existent file, we won't continue.
187+ if (-not (Test-Path - Path " $oscdimgPath " - PathType Leaf)) {
188+ $oscdimgFound = $false
189+ }
190+ }
191+
192+ if (-not ($oscdimgFound )) {
193+ [System.Windows.MessageBox ]::Show(" oscdimg.exe is not found on the system. Cannot continue." )
194+ return
165195 }
166196
167197 Invoke-MicrowinBusyInfo - action " wip" - message " Checking disk space..." - interactive $false
0 commit comments