fix: CHEF-33393 - Fall back to PowerShell syntax for arch detection in WinRM sessions#832
Merged
Nik08 merged 1 commit intoJun 11, 2026
Conversation
…n PowerShell WinRM sessions When wmic is unavailable (e.g., Windows Server 2025 where wmic is deprecated), read_cmd_os falls back to 'echo %PROCESSOR_ARCHITECTURE%'. In PowerShell-based WinRM sessions (the default for Test Kitchen), CMD-style variable expansion is not supported and the literal string '%PROCESSOR_ARCHITECTURE%' is returned. This fix detects the unexpanded literal and falls back to the PowerShell-native syntax '$env:PROCESSOR_ARCHITECTURE', ensuring os.arch is correctly set to 'x86_64' in PowerShell WinRM sessions on Windows 2025. Co-authored-by: Copilot <[email protected]> Signed-off-by: Nik08 <[email protected]>
This was referenced Jun 5, 2026
Open
1 task
Nik08
added a commit
to chef/chef-web-docs
that referenced
this pull request
Jun 12, 2026
Fixed Windows architecture detection over WinRM when os.arch was missing or unknown. Adds robust fallback detection in Train and InSpec. ([#7935](inspec/inspec#7935), train [#832](inspec/train#832)) Co-authored-by: Copilot <[email protected]> Signed-off-by: Nik08 <[email protected]>
Nik08
added a commit
to chef/chef-web-docs
that referenced
this pull request
Jun 12, 2026
Fixed Windows architecture detection over WinRM when os.arch was missing or unknown. Adds robust fallback detection in Train and InSpec. ([#7935](inspec/inspec#7935), train [#832](inspec/train#832)) Co-authored-by: Copilot <[email protected]> Signed-off-by: Nik08 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On Windows Server 2025,
wmichas been deprecated and removed. When train falls back toread_cmd_osfor architecture detection, it runsecho %PROCESSOR_ARCHITECTURE%which is CMD batch syntax. However, WinRM sessions in Test Kitchen default to PowerShell, where%VAR%expansion is not supported — the literal string%PROCESSOR_ARCHITECTURE%is returned instead.This left
os.archasnil/unknown, which caused the InSpecpackageresource to skipWOW6432Noderegistry paths, making 32-bit packages (e.g. .NET Framework SDK, VC++ x86 redistributables) appear as "not installed" duringkitchen verify.Fix: In
read_cmd_os, detect when the CMD command returns the unexpanded literal and fall back to the PowerShell-native$env:PROCESSOR_ARCHITECTURE.Related Issue
CHEF-33393 — InSpec Package Resource Fails in Kitchen Verify on Windows
Types of changes
Checklist: