The install of windows-adk was NOT successful.
Describe the bug
oscdimg fails to install, at windows-adk
To Reproduce
On my system it fails...
Expected behavior
It should successfully install oscdimg
Screenshots
Chocolatey v2.2.2 Installing the following packages: windows-adk-oscdimg By installing, you accept licenses for the packages. Progress: Downloading windows-adk 10.1.22621.2... 100%
windows-adk v10.1.22621.2 [Approved] windows-adk package files install completed. Performing other installation steps. File appears to be downloaded already. Verifying with package checksum to determine if it needs to be redownloaded. Hashes match. Hashes match. Installing Windows Assessment and Deployment Kit... ERROR: Running ["C:\Users\SJ Pretorius\AppData\Local\Temp\chocolatey\windows-adk\10.1.22621.2\adksetup.exe" /quiet /norestart /log C:\Users\SJ Pretorius\AppData\Local\Temp\chocolatey\win_adk.log ] was not successful. Exit code was '1000'. See log for possible error messages. The install of windows-adk was NOT successful. Error while running 'C:\ProgramData\chocolatey\lib\windows-adk\tools\chocolateyinstall.ps1'. See log for details.
Additional context
LOG FILE:
[05EC:1A00][2023-12-07T16:53:31]i001: Burn v3.14.100.17102, Windows v10.0 (Build 22621: Service Pack 0), path: C:\Windows\Temp{BF936166-7CF8-4F32-B029-CCF7C649C16B}.cr\adksetup.exe
[05EC:1A00][2023-12-07T16:53:31]i009: Command Line: '"-burn.clean.room=C:\Users\SJ Pretorius\AppData\Local\Temp\chocolatey\windows-adk\10.1.22621.2\adksetup.exe" -burn.filehandle.attached=572 -burn.filehandle.self=692 /quiet /norestart /log C:\Users\SJ Pretorius\AppData\Local\Temp\chocolatey\win_adk.log'
[05EC:1A00][2023-12-07T16:53:31]i000: Setting string variable 'WixBundleOriginalSource' to value 'C:\Users\SJ Pretorius\AppData\Local\Temp\chocolatey\windows-adk\10.1.22621.2\adksetup.exe'
[05EC:1A00][2023-12-07T16:53:31]i000: Setting string variable 'WixBundleOriginalSourceFolder' to value 'C:\Users\SJ Pretorius\AppData\Local\Temp\chocolatey\windows-adk\10.1.22621.2'
[05EC:1A00][2023-12-07T16:53:31]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\SJ'
[05EC:1A00][2023-12-07T16:53:31]i000: Setting string variable 'WixBundleName' to value 'Windows Assessment and Deployment Kit'
[05EC:1A00][2023-12-07T16:53:31]i000: Setting string variable 'WixBundleManufacturer' to value 'Microsoft Corporation'
[05EC:1A00][2023-12-07T16:53:31]i000: Loading managed bootstrapper application.
[05EC:1A00][2023-12-07T16:53:31]e000: ERROR: Command line error near "Pretorius\AppData\Local\Temp\chocolatey\win_adk.log". Switch expected. Use /help for usage information.
[05EC:1A00][2023-12-07T16:53:31]i000: Creating BA thread to run synchronously.
[05EC:1A00][2023-12-07T16:53:31]i000: Launch action is Install
[05EC:1A00][2023-12-07T16:53:31]i000: Restart action is Never
[05EC:1A00][2023-12-07T16:53:31]i000: Resume action is None
[05EC:1A00][2023-12-07T16:53:31]i000: Display is None
[05EC:1A00][2023-12-07T16:53:31]i000: Loading new setup state
[05EC:1A00][2023-12-07T16:53:31]i000: Current UI Culture: en-US
[05EC:1A00][2023-12-07T16:53:31]i000: Loading localized UX manifest: C:\Windows\Temp{402AD775-B128-427F-BED6-F19899B7914F}.ba\en\UserExperienceManifest.xml
[05EC:1A00][2023-12-07T16:53:31]i000: Setting string variable 'WixBundleName' to value 'Windows Assessment and Deployment Kit'
[05EC:1A00][2023-12-07T16:53:31]i000: Model successfully created
[05EC:1A00][2023-12-07T16:53:31]i000: Trying to acquire global setup mutex.
[05EC:1A00][2023-12-07T16:53:31]i000: View is requesting shutdown
[05EC:1A00][2023-12-07T16:53:31]i500: Shutting down, exit code: 0x3e8
[05EC:1A00][2023-12-07T16:53:31]i000: Releasing global setup mutex.
[05EC:1A00][2023-12-07T16:53:31]i000: OS Architecture: amd64
[05EC:1A00][2023-12-07T16:53:31]i000: OS SKU: 4
[05EC:1A00][2023-12-07T16:53:31]i000: OS Version: 10.0.22621.1
[05EC:1A00][2023-12-07T16:53:31]i000: Current UI Culture: en-US
[05EC:1A00][2023-12-07T16:53:31]i000: Kit Version: 10.1.25398.1
[05EC:1A00][2023-12-07T16:53:31]i410: Variable: WixBundleAction = 5
[05EC:1A00][2023-12-07T16:53:31]i410: Variable: WixBundleElevated = 1
[05EC:1A00][2023-12-07T16:53:31]i410: Variable: WixBundleLog = C:\Users\SJ
[05EC:1A00][2023-12-07T16:53:31]i410: Variable: WixBundleManufacturer = Microsoft Corporation
[05EC:1A00][2023-12-07T16:53:31]i410: Variable: WixBundleName = Windows Assessment and Deployment Kit
[05EC:1A00][2023-12-07T16:53:31]i410: Variable: WixBundleOriginalSource = C:\Users\SJ Pretorius\AppData\Local\Temp\chocolatey\windows-adk\10.1.22621.2\adksetup.exe
[05EC:1A00][2023-12-07T16:53:31]i410: Variable: WixBundleOriginalSourceFolder = C:\Users\SJ Pretorius\AppData\Local\Temp\chocolatey\windows-adk\10.1.22621.2
[05EC:1A00][2023-12-07T16:53:31]i410: Variable: WixBundleProviderKey = {552c6d25-1a53-43da-9069-7cedb7009a80}
[05EC:1A00][2023-12-07T16:53:31]i410: Variable: WixBundleSourceProcessFolder = C:\Users\SJ Pretorius\AppData\Local\Temp\chocolatey\windows-adk\10.1.22621.2
[05EC:1A00][2023-12-07T16:53:31]i410: Variable: WixBundleSourceProcessPath = C:\Users\SJ Pretorius\AppData\Local\Temp\chocolatey\windows-adk\10.1.22621.2\adksetup.exe
[05EC:1A00][2023-12-07T16:53:31]i410: Variable: WixBundleTag =
[05EC:1A00][2023-12-07T16:53:31]i410: Variable: WixBundleUILevel = 2
[05EC:1A00][2023-12-07T16:53:31]i410: Variable: WixBundleVersion = 10.1.25398.1
[05EC:1A00][2023-12-07T16:53:31]i007: Exit code: 0x3e8, restarting: No
I have the same issue on an up-to-date WIndows 11. To make things worse, even if I install it myself (winget install --exact --id Microsoft.WindowsADK) it still doesn't get detected.
Strange thing is, I took a peek in the code (Invoke-WPFGetIso.ps1) and the Get-Command on line 21 should absolutely evaluate as $True on my system, I tested it by hand (by the way, you're using $oscdImgFound on the choco test on line 31 instead of $chocoFound).
To force the thing I set $oscdImgFound statically to $True and it still tells me it can't find it. I must missing something. I'm due for a reinstall so I'm gonna try and remove the check altogether and see what happens.
PS You write like a coder, not a scripter. 😄
Ah, I think I see the reported problem already by the way. Both usernames have spaces in them. In the above case, the log reads:
[05EC:1A00][2023-12-07T16:53:31]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\SJ'
[05EC:1A00][2023-12-07T16:53:31]e000: ERROR: Command line error near "Pretorius\AppData\Local\Temp\chocolatey\win_adk.log". Switch expected. Use /help for usage information.
The path to the profile (and Temp directory) is "C:\Users\SJ Pretorius"
We'd be needin' some quotes there.
And guess what, try running it on PowerShell 7.3+ and it will break even more.
Right, you're merging everything into winutil.ps1 and that's what the consumer uses. And I think you've encountered the PowerShell 7.3+ issue and been busy replacing your Call operators (&'s) with Start-Processes. I feel for you if you did, with something this size it's not an easy bug to work with.
Fun fact: apparently if Start-Process can't find the app it'll still give exit code 0 and your tool happily continues with cleanup. I got so close to success that time.
To the original poster, You could try running it from a user profile without spaces. I can in theory guide you through the workaround, it's only editing 2 lines for me. Depends entirely on how well-versed you are in PowerShell. But if it's no rush, wait for Chris, I would rather not step on people's toes here, open-source or not.
Anyways, I have a working ISO now so it's time to reboot to Ventoy and see what happens.
In all fairness, the code should work fine. It's Windows and PowerShell doing something odd here. The fact that both Get-Command and Start-Process fail to find the app when running in the context of WinUtil is silly. Both of them do fine when run standalone. Even when switching back to the & I had to insert the full path name to make it work.
Right, you're merging everything into winutil.ps1 and that's what the consumer uses. And I think you've encountered the PowerShell 7.3+ issue and been busy replacing your Call operators (&'s) with Start-Processes. I feel for you if you did, with something this size it's not an easy bug to work with.
Fun fact: apparently if Start-Process can't find the app it'll still give exit code 0 and your tool happily continues with cleanup. I got so close to success that time.
To the original poster, You could try running it from a user profile without spaces. I can in theory guide you through the workaround, it's only editing 2 lines for me. Depends entirely on how well-versed you are in PowerShell. But if it's no rush, wait for Chris, I would rather not step on people's toes here, open-source or not.
Anyways, I have a working ISO now so it's time to reboot to Ventoy and see what happens.
In all fairness, the code should work fine. It's Windows and PowerShell doing something odd here. The fact that both Get-Command and Start-Process fail to find the app when running in the context of WinUtil is silly. Both of them do fine when run standalone. Even when switching back to the & I had to insert the full path name to make it work.
I encourage you to make a pull request with your fixes :)
I encourage you to make a pull request with your fixes :)
Considered it, but it is a temporary workaround specifically disabling a validation check and hardcoding a path to an application (lines 2238 and 2767/2768 in winutil.ps1). Not something which should be used in general circulation. Not to mention Chris does that merging thing into a monolithic script which I have not fully figured out (yet), so I'd be breaking things.
If I do end up studying the code more deeply and fixing/improving things I will happily do so. I love collaborating on projects like these, they make Windows better and help keeping people on Windows rather than run away to Linux. 😄
I encourage you to make a pull request with your fixes :)
Considered it, but it is a temporary workaround specifically disabling a validation check and hardcoding a path to an application (lines 2238 and 2767/2768 in winutil.ps1). Not something which should be used in general circulation. Not to mention Chris does that merging thing into a monolithic script which I have not fully figured out (yet), so I'd be breaking things.
If I do end up studying the code more deeply and fixing/improving things I will happily do so. I love collaborating on projects like these, they make Windows better and help keeping people on Windows rather than run away to Linux. 😄
It's all done via the .\Compile script where the merging happens. You can make changes to the other files as needed. In this case, the first line item you provided is in .\Invoke-WPFGetIso.ps1 and the second items you mention are in .\Invoke-WPFMicrowin.ps1.
I do understand the confusion, took me a bit of a deep dive to understand also.. It also helps that I've watched him make changes enough on his Twitch stream lol.
Additionally, he'd have to review your commit(s) and approve them, then merge them. So technically, he'd be the one breaking things if he pushed a bad commit through!
In other news, yeah I don't think that disabling a validation check and setting the value to $TRUE would be ideal in any case here. I'm sure there are other options that can be taken into account. I'll take a look myself but I don't/haven't dealt with this specific issue. Looking back, there are other open issues where the path/username contains a space.. So it appears to be 100% legitimate as an issue. I'll look at making a new ISO and intentionally recreate the issue to see where we can go.
EDIT: I may not have to create an ISO to test this. DOH! More than one way to insert joke about a cat
Well... this is awkward but it turns out that replacing
$oscdImgFound = [bool] (Get-Command -ErrorAction Ignore -Type Application oscdimg)
with
$oscdImgFound = [bool] (Get-Command -ErrorAction Ignore -Type Application 'oscdimg.exe')
does actually make the check evaluate as True.
That said, I expect the Start-Process to make the ISO will still break. Not to mention the install using Chocolatey if the evaluation is False. So the issue is still valid and possibly related to spaces in usernames.
If I ever do find enough time to study the code more deeply I will.
EDIT: I may have to watch one of those Twitch streams to see if he mentions some meddling kid called PowerCoder who talks a lot without providing actual solutions. :)
EDIT2: Looking at the original post, I think this is a Chocolatey issue and can not be fixed easily:
ERROR: Running ["C:\Users\SJ Pretorius\AppData\Local\Temp\chocolatey\windows-adk\10.1.22621.2\adksetup.exe" /quiet /norestart /log C:\Users\SJ Pretorius\AppData\Local\Temp\chocolatey\win_adk.log ] was not successful. Exit code was '1000'. See log for possible error messages.
The quotes are missing after the /log parameter. And that's all Choco. Should probably be reported there.
It might be possible to switch to Winget like I did.
Final EDIT I promise: Using the --log-file parameter in the Choco commandline may allow you to redirect it to a path which can be controlled?
:
ERROR: Running ["C:\Users\SJ Pretorius\AppData\Local\Temp\chocolatey\windows-adk\10.1.22621.2\adksetup.exe" /quiet /norestart /log C:\Users\SJ Pretorius\AppData\Local\Temp\chocolatey\win_adk.log ] was not successful. Exit code was '1000'. See log for possible error messages.The quotes are missing after the/logparameter. And that's all Choco. Should probably be reported there.It might be possible to switch to Winget like I did.
Final EDIT I promise: Using the --log-file parameter in the Choco commandline may allow you to redirect it to a path which can be controlled?
@PowerCoder first of all thank you for the great investigation. I think you discovered several issues not just one. To get around Choco @ChrisTitusTech we might want to consider BASE64ing oscdimg.exe into winutil.ps1. That's the only exe we use from the ADK and that's the only reason why we install ADK. Installing ADK (which is huge) seems like an overkill but the reason why I did that is I didn't want people to complain that we have a shady oscdimg.exe in the tool. Another thing we can do it check it into github with SHA256 sig and download it when Microwin runs.
Closed due to inactivity
bump for activity