Link to home
Start Free TrialLog in
Avatar of sirbounty
sirbountyFlag for United States of America

asked on

powershell parameters

I'm attempting to run a cmdlet in my script that accepts different parameters.
I have two scenarios that I'm trying to cover in one logical statement.
Is there a way to build the parameter set before running the cmdlet so that I can reduce my code?
Here's a brief pseudo-example:

If ($primary -eq $true) {
 $parms = "-location 'campus' -operatinghours 'daylight'"
} else
 $parms = "-location 'extension' -operatinghours 'nightly'"
}
create-widget $parms
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial