PowerTip: Identify which Platform PowerShell is running on
Summary: Using $PSVersionTable to identify if you are on Windows or Unix
Hey, Doctor Scripto! I’m working on my PowerShell scripts and I need to be able to identify if I’m working on Windows or Linux. How can I do this easily?
No problem at all and glad to help. Just examine the $PSVersionTable property called Platform. It will contain one either ‘Unix’,’Win32NT’ on PowerShell Core. In the case of Windows PowerShell it will not exist.
PowerShell, Doctor Scripto, PowerTip, Sean Kearney
I like the isWindows, isLinux, isMacOS variables but this is a nice one.