I think you need sets that aren't disjoint, something like

Param(

    # things to back up
    [Parameter(Mandatory=$true, ParameterSetName='backupinfo')]
    [Parameter(Mandatory=$true, ParameterSetName='mailTo')] [string]
$include,
    # disk or network path to backup to
    [Parameter(Mandatory=$true, ParameterSetName='backupinfo')]
    [Parameter(Mandatory=$true, ParameterSetName='mailTo')] [string]
$backupTo,
    # directory to put log files in
    [Parameter(Mandatory=$true, ParameterSetName='backupinfo')]
    [Parameter(Mandatory=$true, ParameterSetName='mailTo')] [string]
$logDir,

    # email address to mail report to
    [Parameter(Mandatory=$true,ParameterSetName='mailTo')][string] $mailTo,

    # SMTP host used to send email
    [Parameter(Mandatory=$true,ParameterSetName='mailTo')][string] $smtpHost

    # option, eject media when done
    [Parameter (ParameterSetName='backupinfo')]
    [Parameter (ParameterSetName='mailTo')] [switch] $eject = $false

)

Seems to me it might be easier to explicitly test smtphost in this case.
Or maybe MBS will educate us....


Jeff


On Fri, Apr 12, 2013 at 7:04 PM, Ben Scott <[email protected]> wrote:

> On Fri, Apr 12, 2013 at 6:59 PM, Ben Scott <[email protected]> wrote:
> > If can tell PowerShell that one parameter is related to another, but
> > I can't figure out how to tell it one parameter *depends* on another.
>
>   Correction: First line above should begin with "I can tell PowerShell
> ....".
>
>   I blame the cold I have.
>
> -- 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 [email protected]
> 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 [email protected]
with the body: unsubscribe ntsysadmin

Reply via email to