Skip to content

Instantly share code, notes, and snippets.

@vamseekolluri
Created July 25, 2017 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vamseekolluri/5a3bdb75aebfe5694ed738d0be8fa27d to your computer and use it in GitHub Desktop.
Save vamseekolluri/5a3bdb75aebfe5694ed738d0be8fa27d to your computer and use it in GitHub Desktop.
cls
$psver=$PSVersionTable.PSVersion.Major
$mystr="aaa"
$myarr="aaa","bbb","ccc"
if($psver -eq 2)
{
write-host "Executing on Version 2"
$myarr -contains $mystr
}
elseif($psver -eq 5)
{
write-host "Executing on Version 5"
$mystr -in $myarr #this statement results in error on PS2.0 environment. Error message is "You must provide a value expression on the right-hand side of the '-' operator"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment