ironmansoftware / universal-automation

Universal Automation is the PowerShell-first automation platform.
https://ironmansoftware.com/universal-automation/
MIT License
24 stars 4 forks source link

PowerShell versions reported odly #103

Closed gpduck closed 4 years ago

gpduck commented 4 years ago

My pwsh.exe doesn't show the "logo" text when I launch it from the shortcut and it seems like UA is expecting to parse this to populate the "PowerShell Version" dropdown when running a script.

Name                           Value
----                           -----
PSVersion                      6.2.4
PSEdition                      Core
GitCommitId                    6.2.4
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

My dropdown looks like this:

image

Maybe reporting the exe name and version would be better?

adamdriscoll commented 4 years ago

I've added the ability to manage PS versions. You can add, edit and delete em. The auto-located runs powershell.exe -NoProfile -Command { $PSVersionTable.Version } so I'm not sure why its complaining about the profile. Either way, you can fix it if it happens.

claudiospizzi commented 4 years ago

I think you have to reopen this issue, beacuse it's not solved. In the trace I can see the following calls:

"C:\Program Files\PowerShell\7\pwsh.exe" -Command "& { $PSVersionTable.PSVersion.ToString() }" -NoLogo -NoProfile
"C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -Command "& { $PSVersionTable.PSVersion.ToString() }" -NoLogo -NoProfile

The problem is, that the switches -NoLogo and -NoProfile are after the -Command and will be passed to the script block of the command as arguments instead to the PowerShell exe.

This way around should be better:

"C:\Program Files\PowerShell\7\pwsh.exe" -NoLogo -NoProfile -Command "& { $PSVersionTable.PSVersion.ToString() }"
"C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -Command "& { $PSVersionTable.PSVersion.ToString() }"
claudiospizzi commented 4 years ago

Or should I open a new issue? @adamdriscoll