For example:
Send-MailMessage -To $to -From $sender -subject $subject -SmtpServer $mailserver -Attachments $efile -EA Stop
All those switches are documented on http://technet.microsoft.com/en-us/library/dd347693.aspx except the -EA switch.
What does this switch do and where can I find documentation on it (and its arguments)?
-ea
is parameter alias for -ErrorAction
. See http://ss64.com/ps/common.html . It's listed in the common parameters in the Send-MailMessage
documentation.
This shows the options for ErrorAction:
[enum]::getValues([System.Management.Automation.ActionPreference]) | % {"$_ = (" + [int]$_ + ")"}
You can use the string or the number as the parameter value.
SilentlyContinue = (0)
Stop = (1)
Continue = (2)
Inquire = (3)
Send-MailMessage -EA Inquire
or Send-MailMessage -EA 3
are both valid.
Here's how you can get parameter aliases for a given command:
PS> $cmd = 'Get-ChildItem'
PS> (Get-Command $cmd).Parameters.GetEnumerator() | Select-Object Key,@{n='Aliases';e={$_.Value.Aliases}}
Key Aliases
--- -------
Path {}
LiteralPath PSPath
Filter {}
Include {}
Exclude {}
Recurse {}
Force {}
Name {}
Verbose vb
Debug db
ErrorAction ea
WarningAction wa
ErrorVariable ev
WarningVariable wv
OutVariable ov
OutBuffer ob
UseTransaction usetx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With