Skip to content

Instantly share code, notes, and snippets.

@vamseekolluri
Created July 24, 2017 21:50
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/4c9f9773ac66e6ce7bdf9e4c858ed93b to your computer and use it in GitHub Desktop.
Save vamseekolluri/4c9f9773ac66e6ce7bdf9e4c858ed93b 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