Description
System Details
- Operating system name and version: Server 2012 R2
- VS Code version: None
- PowerShell extension version: None
- Output from
$PSVersionTable
: Name Value
PSVersion 5.1.14409.1012
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1012
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Issue Description
Installing using the script:
PS C:\Users\XXX> Install-Script Install-VSCode -Scope CurrentUser; Install-VSCode.ps1
C:\Users\XXX\Documents\WindowsPowerShell\Scripts\Install-VSCode.ps1 : The variable '$IsLinux' cannot be retrieved because it has not been set.
At line:1 char:51
- Install-Script Install-VSCode -Scope CurrentUser; Install-VSCode.ps1
-
~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (IsLinux:String) [Install-VSCode.ps1], RuntimeException
- FullyQualifiedErrorId : VariableIsUndefined,Install-VSCode.ps1
This is because StrictMode is on, and you're checking a variable that doesn't exist. It's best practice to do checking of variables in a way that doesn't trigger errors.