Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Help with if statement in parameter

$
0
0

Can I run this as a parameter?

$Switch = if ((Get-VMSwitch).Name.count -gt 1) {(Get-VMSwitch).Name -notmatch "SCSI" | select -First 1} else {(Get-VMSwitch).name}

 

It seems to work on the command line but I can't run it as a parameter.  This is for Hyper-V on Windows 2012 with Powershell v3.  If I can't run that as a parameter, any alternatives?  Thanks!

 

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles