From 91ef5ef91e7912c7a99ac8f6d688b6f81bfd0ec2 Mon Sep 17 00:00:00 2001 From: Lucas Pinheiro Date: Tue, 8 Mar 2022 17:20:58 -0300 Subject: [PATCH] Fix isWindows check (#305) --- install-self-hosted-toolbox.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/install-self-hosted-toolbox.ps1 b/install-self-hosted-toolbox.ps1 index 664a18e8..9dc853ef 100644 --- a/install-self-hosted-toolbox.ps1 +++ b/install-self-hosted-toolbox.ps1 @@ -1,6 +1,8 @@ $ErrorActionPreference = "Stop" -if ($IsWindows) { +# PowerShell Core 6.0+ has $isWindows set, but older versions don't. +# For those versions, we use the $env:OS variable, which is only set in Windows. +if ($IsWindows -or $env:OS) { $ModulePath = $Env:PSModulePath.Split(";")[0] } else { $ModulePath = $Env:PSModulePath.Split(":")[0]