If ((Get-WindowsCapability -Online -Name PowerShell-V2).State -eq "NotPresent") { return 0 } else { #Installed return 1 }