I’m very noob .Net C# developer, but I remember this:

<compare> ? <value of true> : <value of false>

(a == ‘a’ ) ? 1 : 2

I want the same thing in PowerShell, here we go:

Sample:

Which I came up with a more readable and something easy to memory:

 

Happy scripting….