I prefer to set Connect-VIServer to a variable and -NotDefault then then set the -Server attribute on any Get-* New-* cmdlets. E.G.
$viserver = Connect-VIServer -Server vc1 -Credential $cred -NotDefault
Get-VMHost -Server $viserver
However the New-SpbmRuleSet doesn't have a -Server attribute but errors if there is not a Default connection set.
Working example but doesn't limit to a specific vCenter. Needs extra logic to ensure only one vCenter is in the default varriable.
Connect-VIServer -Server vc1 -Credential $cred New-SpbmRuleSet -AllOfRules $rules
Prefered code but fails with unkown -Server attribute
$viserver = Connect-VIServer -Server vc1 -Credential $cred New-SpbmRuleSet -Server $viserver -AllOfRules $rules
Is there a work-around although this looks like an over-sight in the cmdlet?
Otherwise anyone know how to report a bug / feature request for PowerCli so that I can register an interest in having the -Server attribute added to the New-SpbmRuleSet cmdlet.
You can open an SR for PowerCLI.
If GSS incorrectly claims you need a Developer contract for that point them to PowerCLI Support Breakdown
There is also the PowerCLI Ideas site where you can create ideas/suggestions for PowerCLI.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can open an SR for PowerCLI.
If GSS incorrectly claims you need a Developer contract for that point them to PowerCLI Support Breakdown
There is also the PowerCLI Ideas site where you can create ideas/suggestions for PowerCLI.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
On the missing Server parameter, is that really required on the New-SpbmRuleSet?
You have to specify the Rules parameter (required), and on the New-SpbmRule, which you use to create rules, there is a Server parameter.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for your replies LucD. It is much appreciated.
I hoped your suggestion was the answer when I first discovered the issue and New-SpbmRuleSet would indeed use the rule connection and not need a specific one. However, when tested with just a specific connection, the rules create but not the rule set, failing with the error "No available connection to vCenter, connect and try again" (para phrased).
I will use the links to raise an SR.