Use the cmdlet Get-Variable to find them, and keep in mind, these variables are not found in Windows PowerShell 5.x.
Although, the results will display four variable, but let’s pay attention to three of them. Below are the variables with their default values:
These three variables can help in identifying which Operating System the script are been executed. This way just adding the necessary logic, in order to take the correct action.
Read on for a code example showing how to use these variables.