Bird
0
0

Which of the following is the correct syntax to send an email alert using PowerShell's Send-MailMessage cmdlet?

easy📝 Syntax Q12 of 15
PowerShell - Automation Patterns
Which of the following is the correct syntax to send an email alert using PowerShell's Send-MailMessage cmdlet?
ASend-MailMessage -Sender 'admin@example.com' -Receiver 'user@example.com' -Title 'Alert' -Content 'Issue detected' -Server 'smtp.example.com'
BSend-Mail -From 'admin@example.com' -To 'user@example.com' -Subject 'Alert' -Body 'Issue detected' -Server 'smtp.example.com'
CSend-MailMessage -From 'admin@example.com' -To 'user@example.com' -Subject 'Alert' -Body 'Issue detected' -SmtpServer 'smtp.example.com'
DSend-Email -From 'admin@example.com' -To 'user@example.com' -Subject 'Alert' -Body 'Issue detected' -SmtpServer 'smtp.example.com'
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct cmdlet and parameters

    The correct cmdlet is Send-MailMessage with parameters -From, -To, -Subject, -Body, and -SmtpServer.
  2. Step 2: Check each option's syntax

    Send-MailMessage -From 'admin@example.com' -To 'user@example.com' -Subject 'Alert' -Body 'Issue detected' -SmtpServer 'smtp.example.com' uses correct cmdlet and parameter names. Others use incorrect cmdlet names or parameter names.
  3. Final Answer:

    Send-MailMessage -From 'admin@example.com' -To 'user@example.com' -Subject 'Alert' -Body 'Issue detected' -SmtpServer 'smtp.example.com' -> Option C
  4. Quick Check:

    Send-MailMessage + correct params = A [OK]
Quick Trick: Send-MailMessage with -From, -To, -Subject, -Body, -SmtpServer [OK]
Common Mistakes:
  • Using wrong cmdlet names like Send-Mail or Send-Email
  • Incorrect parameter names like -Sender or -Receiver
  • Missing -SmtpServer parameter

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes