Reputation: 1
I'm by no means a Powershell expert, so there may be some misuse of terms:
I'm editing a script to install pieces of software based upon the value of a variable. I want to permit multiple strings so what gets installed can be cherry-picked. Examples:
installsoftware.ps1 -DeployModules "Base, Pack1, Pack3"
installsoftware.ps1 -DeployModules "All"
How would people suggest I accomplish this? Thanks
Upvotes: 0
Views: 85
Reputation: 68341
I'd so something like this:
param ([string[]]$DeployModules)
Switch -Regex ($DeployModules)
{
'Base|All'
{
'deploy Base module'
}
'Pack1|All'
{
'deploy Pack1 module'
}
'Pack3|All'
{
'deploy Pack3 module'
}
}
Upvotes: 2