-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
It would be nice to be able to specify the rule not only by name, but also by type, when importing DRS rules from a file.
The way it's implemented right now, if I say have a host group called "host2" and VM to host rule "host2" and I call Import-DrsRule with the following parameters:
Import-DrsRule -Cluster "my-cluster" -Path "drs-rule-export.json" -Name "host2"
Cmdlet will attempt to import both the group and the rule, which is not always what you want. This is the bit of code that checks the name:
## if -Name was specified, filter
if ($PSBoundParameters.ContainsKey("Name")) {$arrRuleObjects_filtered = $arrRuleObjects_filtered | Where-Object -FilterScript {$_.Name -like $Name}}
The following piece of code will need to be added to also check for type:
## if -Type was specified, filter
if ($PSBoundParameters.ContainsKey("Type")) {$arrRuleObjects_filtered = $arrRuleObjects_filtered | Where-Object -FilterScript {$_.Type -like $Type}}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels