You could try adding a "Position=X" to the parameters to deal with the ambiguity; might have to move $eject elsewhere in the parameter order though.
On Sat, Apr 13, 2013 at 2:43 PM, Ben Scott <mailvor...@gmail.com> wrote: > On Sat, Apr 13, 2013 at 2:02 PM, Jeff Bunting <bunting.j...@gmail.com> > wrote: > > I think you need sets that aren't disjoint, something like > > I didn't think of that. Good idea. But, I just tried it, and that > doesn't work either. :( I'm guessing it makes the "base" parameter > set ambiguous, as it overlaps exactly with the "mailTo" parameter set. > So, if I don't specify -mailTo, PowerShell pukes trying to figure out > which parameter set I want: > > C:\Users\BSCOTT\Desktop\param_test.ps1 : Parameter set cannot be > resolved using the specified named parameters. > At line:1 char:17 > + .\param_test.ps1 <<<< -include c:\ -backupTo z:\ -logdir d:\logs > + CategoryInfo : InvalidArgument: (:) [param_test.ps1], > ParameterBindingException > + FullyQualifiedErrorId : AmbiguousParameterSet,param_test.ps1 > > It does do the Right Thing when -mailTo is specified, though: > -smtpHost becomes mandatory. So closer in one direction, but broke > something else, as is so often the case. > > I suppose I could add a parameter -noMail and put it in just the > "base" parameter set, but I find that even uglier than testing > smtpHost explicitly. :) > > -- Ben > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ > ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > > --- > To manage subscriptions click here: > http://lyris.sunbelt-software.com/read/my_forums/ > or send an email to listmana...@lyris.sunbeltsoftware.com > with the body: unsubscribe ntsysadmin > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ --- To manage subscriptions click here: http://lyris.sunbelt-software.com/read/my_forums/ or send an email to listmana...@lyris.sunbeltsoftware.com with the body: unsubscribe ntsysadmin