Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows architecture detection failure in helpers.ps1.erb #230

Closed
nweddle opened this issue Aug 7, 2017 · 1 comment
Closed

Windows architecture detection failure in helpers.ps1.erb #230

nweddle opened this issue Aug 7, 2017 · 1 comment

Comments

@nweddle
Copy link

nweddle commented Aug 7, 2017

In the PowerShell helpers.ps1.erb template, the Get-Win32OS function is called to collect Windows OS details via WMI and return the results as an object with properties.

However, the function goes on to set the object result into a Windows system environment variable: $env:win32OS. Doing so converts the object to a string, using only the Caption property. Any other properties are discarded and are no longer available.

This causes the Get-PlatformVersion and Get-PlatformArchitecture functions to return invalid results.

Changing lines 29 to 35 to use a PowerShell variable such as $win32OS, as opposed to an environment variable $env:win32OS, should return the Get-Win32OS function back to expected behavior.

function Get-Win32OS {
if(!$env:win32OS)
{
$env:win32OS = Get-WMIQuery win32_operatingsystem
}
$env:win32OS
}

@wrightp
Copy link

wrightp commented Aug 9, 2017

@nweddle If you've diagnosed the problem would you mind please submitting a PR and then test your changes? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants