You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Host sniffing is bad; testing for features is good. Is this something we envisage being useful information in the grand scheme things? Esp. since there's an issue somewhere else tracking a desire for a Get-OperatingSystemInfo cmdlet/function.
Good point - I was thinking more from a "how can I repro" perspective, but folks would likely start using the property in scripts thinking it's useful.
Maybe we need a Get-PowerShellReproEnvironment cmdlet that we ask folks to run instead.
Reacted by Oisin Grehan, Mikey Lombardi (He/Him) and kiedtl
And it might be helpful for such an environment to list loaded module names & version numbers as well. Might also be nice to have list the architecture (x86, x64, ARM32) of the OS and PowerShell (for those cases where x86 PS is running on x64 Windows).
Oisin Grehan (@oising): testing for features is good, but you don't want to test for features to decide simple things like what library to load. E.g. if I ship System.Data.SqlClient in my module, it has .Net452, .Net46, and separate .NetStandard assemblies for Windows and for Unix. Just to be able to load the right one I need to know OS and Arch. I think it would be enough to know:
OS: Windows or Unix
Architecture: ARM, amd64, x86
Reacted by Warren Frame, Keith Hill, mi-hol, Michael Klement, lw-schick and Mahmudur Rahman
Just do it. It will make it easier for scripts to know where to look for environmental info and it will make it easier for you to get bug reports with that same environment info.
Yeah, I used to agree with Oisin Grehan (@oising)'s opinion here that we shouldn't expose this because it encourages people to "do the wrong thing" when checking for certain kinds of compat at runtime.
Until I saw the kind of lengths people will go to in order to check for these sorts of things anyway. They'll do it one way or another, and at least this way it's easier to understand when and why people are checking for OS so we can mitigate it in the future. (E.g. I want to know that Joel Bennett (@Jaykul) is testing for OS because of x-CLR assembly issues, so that I know we need to adopt .NET Standard 2.0).
That being said, I still agree that checking for features is generally the right thing to do, and we should absolutely have a PSSA rule to throw warnings on checks against $PSVersionTable.OS at runtime.
Oh, and of course, we still need to design this thing. Is it Windows, Mac, Linux? Or do we get down to the distro level? Nano Server? Linux kernel version? Probably needs an RFC...
@PowerShell/powershell-committee I agree w/ Joel Bennett (@Jaykul) on this one. We should try and move to CoreFX's Environment.OSVersion when it's available (looks like 2.0 timeframe): dotnet/corefx#9851
The next question is whether or not we should propagate $PSVersionTable with Environment.OSVersion or make users search the web to learn about it (leaning towards the former, but I'm open to being told I'm wrong here).
I think OSVersion.Platform and OSVersion.Version are both super useful as they don't require any string parsing to get at Windows v. non-Windows and the kernel version. Beyond that, I think we should expose [System.Runtime.InteropServices.RuntimeInformation]::OSDescription as our own uname -a string as well.
I know this might be ballooning $PSVersionTable, but it all feels like useful info.
Joey Aiello (@joeyaiello) could you give me a mock information $PSVersionTable.OS should give out?
for example, should $PSVersionTable.OS looks like this? (combine the osversion and osdescription)
$PSVersionTable.OS
Platform : Unix
ServicePack :
Version : 4.8.0.41
VersionString : Unix 4.8.0.41
OSDescription: Linux 4.8.0-41-generic #44~16.04.1-Ubuntu SMP Fri Mar 3 17:11:16 UTC 2017
Joey Aiello (@joeyaiello) Do we really want Platform since we're keeping $IsUnix/$IsWindows/etc... for automation purposes? Seems like OSDescription is the only thing we really need here primarily for logging purposes.
Chunqing Chen (@chunqingchen) Yeah, I guess just make $PSVersionTable.OS equivalent to [System.Environment]::OSVersion for now. That's fine.
I'm not super sold on $IsUnix/$IsWindows, but I'd like to understand .NET Core 2.0's platform differentiation a little better before I form a strong opinion.
BTW the longer you wait, the more modules get published that rely on $Is*. :-) posh-git aleady relies on these variables but we could switch to the "preferred way" of testing for the OS platform.
Joey Aiello (@joeyaiello) did you really mean [System.Environment]::OSVersion (which is not really useful) or [System.Runtime.InteropServices.RuntimeInformation]::OSDescription which is equivalent to uname -a? I was saying the latter makes sense
We also agreed that OSVersion.Platform should probably be included as well. It's possible that $IsWindows and its ilk should become "dumb accelerators" and query that directly.
Is [System.Runtime.InteropServices.RuntimeInformation]::OSDescription really always different?
I mean can we distinguish between Ubuntu LTS, Release and so on? Windows Desktop, Server, Core, IoT?
Activity
oising commentedon Aug 4, 2016
Host sniffing is bad; testing for features is good. Is this something we envisage being useful information in the grand scheme things? Esp. since there's an issue somewhere else tracking a desire for a
Get-OperatingSystemInfocmdlet/function.lzybkr commentedon Aug 4, 2016
Good point - I was thinking more from a "how can I repro" perspective, but folks would likely start using the property in scripts thinking it's useful.
Maybe we need a
Get-PowerShellReproEnvironmentcmdlet that we ask folks to run instead.rkeithhill commentedon Aug 5, 2016
And it might be helpful for such an environment to list loaded module names & version numbers as well. Might also be nice to have list the architecture (x86, x64, ARM32) of the OS and PowerShell (for those cases where x86 PS is running on x64 Windows).
Jaykul commentedon Aug 21, 2016
Oisin Grehan (@oising): testing for features is good, but you don't want to test for features to decide simple things like what library to load. E.g. if I ship System.Data.SqlClient in my module, it has .Net452, .Net46, and separate .NetStandard assemblies for Windows and for Unix. Just to be able to load the right one I need to know OS and Arch. I think it would be enough to know:
rkeithhill commentedon Sep 29, 2016
Just do it. It will make it easier for scripts to know where to look for environmental info and it will make it easier for you to get bug reports with that same environment info.
joeyaiello commentedon Dec 14, 2016
Yeah, I used to agree with Oisin Grehan (@oising)'s opinion here that we shouldn't expose this because it encourages people to "do the wrong thing" when checking for certain kinds of compat at runtime.
Until I saw the kind of lengths people will go to in order to check for these sorts of things anyway. They'll do it one way or another, and at least this way it's easier to understand when and why people are checking for OS so we can mitigate it in the future. (E.g. I want to know that Joel Bennett (@Jaykul) is testing for OS because of x-CLR assembly issues, so that I know we need to adopt .NET Standard 2.0).
That being said, I still agree that checking for features is generally the right thing to do, and we should absolutely have a PSSA rule to throw warnings on checks against $PSVersionTable.OS at runtime.
Oh, and of course, we still need to design this thing. Is it
Windows, Mac, Linux? Or do we get down to the distro level? Nano Server? Linux kernel version? Probably needs an RFC...Jaykul commentedon Jan 14, 2017
But please ... get rid of the top level
$IsWindows,$IsLinuxvariables, that's ... icky.joeyaiello commentedon Jan 23, 2017
@PowerShell/powershell-committee I agree w/ Joel Bennett (@Jaykul) on this one. We should try and move to CoreFX's
Environment.OSVersionwhen it's available (looks like 2.0 timeframe): dotnet/corefx#9851The next question is whether or not we should propagate
$PSVersionTablewithEnvironment.OSVersionor make users search the web to learn about it (leaning towards the former, but I'm open to being told I'm wrong here).9 remaining items
daxian-dbw commentedon Apr 13, 2017
System.Environment.OSVersionis back innetstandard2.0, but it's not very useful on unix platform. For example, onUbuntu 16.04:System.Runtime.InteropServices.RuntimeInformation.OSDescriptionmay be a potential substitution:SteveL-MSFT commentedon Apr 13, 2017
OSDescriptionlooks like part of the output fromuname -a. Seems like the way to go.chunqingchen commentedon Apr 14, 2017
taking a look on this
iSazonov commentedon Apr 14, 2017
If the next what we want, then we could ask CoreFX team:
joeyaiello commentedon Apr 14, 2017
I think
OSVersion.PlatformandOSVersion.Versionare both super useful as they don't require any string parsing to get at Windows v. non-Windows and the kernel version. Beyond that, I think we should expose[System.Runtime.InteropServices.RuntimeInformation]::OSDescriptionas our ownuname -astring as well.I know this might be ballooning
$PSVersionTable, but it all feels like useful info.chunqingchen commentedon Apr 18, 2017
Joey Aiello (@joeyaiello) could you give me a mock information $PSVersionTable.OS should give out?
for example, should $PSVersionTable.OS looks like this? (combine the osversion and osdescription)
$PSVersionTable.OS
Platform : Unix
ServicePack :
Version : 4.8.0.41
VersionString : Unix 4.8.0.41
OSDescription: Linux 4.8.0-41-generic #44~16.04.1-Ubuntu SMP Fri Mar 3 17:11:16 UTC 2017
SteveL-MSFT commentedon Apr 18, 2017
Joey Aiello (@joeyaiello) Do we really want
Platformsince we're keeping $IsUnix/$IsWindows/etc... for automation purposes? Seems likeOSDescriptionis the only thing we really need here primarily for logging purposes.joeyaiello commentedon Apr 19, 2017
Chunqing Chen (@chunqingchen) Yeah, I guess just make
$PSVersionTable.OSequivalent to[System.Environment]::OSVersionfor now. That's fine.I'm not super sold on
$IsUnix/$IsWindows, but I'd like to understand .NET Core 2.0's platform differentiation a little better before I form a strong opinion.rkeithhill commentedon Apr 19, 2017
BTW the longer you wait, the more modules get published that rely on $Is*. :-) posh-git aleady relies on these variables but we could switch to the "preferred way" of testing for the OS platform.
SteveL-MSFT commentedon Apr 19, 2017
Joey Aiello (@joeyaiello) did you really mean
[System.Environment]::OSVersion(which is not really useful) or[System.Runtime.InteropServices.RuntimeInformation]::OSDescriptionwhich is equivalent touname -a? I was saying the latter makes sensejoeyaiello commentedon Apr 19, 2017
Per our discussion today, I'm on board with the recommendation from Steve Lee (@SteveL-MSFT).
We also agreed that
OSVersion.Platformshould probably be included as well. It's possible that$IsWindowsand its ilk should become "dumb accelerators" and query that directly.iSazonov commentedon Apr 20, 2017
Is
[System.Runtime.InteropServices.RuntimeInformation]::OSDescriptionreally always different?I mean can we distinguish between Ubuntu LTS, Release and so on? Windows Desktop, Server, Core, IoT?