Author: brissieadmin

  • Sending an email via PowerShell

    The below PowerShell block will give you details on how to setup a SMTP script for sending email.

    # ==============================
    # SMTP CONFIGURATION
    # ==============================
    $From        = "[email protected]"     # The "From" address (must be allowed to send mail)
    $To          = "[email protected]"         # Recipient email
    $SMTPServer  = "smtp.yourdomain.com"        # SMTP server address
    $SMTPPort    = 587                          # SMTP port (25/465/587 depending on your setup)
    $SMTPUser    = "[email protected]"     # SMTP auth user
    $SMTPPass    = "YOUR_SMTP_PASSWORD"         # SMTP password
    
    
    
    Now you've setup the basics to send out emails.
    
    Now the part of sending an actual email:
    
    
    EMAIL REPORT
    # ==============================
    Write-Host "Sending email" -ForegroundColor Cyan
    
    $SMTP = New-Object System.Net.Mail.SmtpClient($SMTPServer, $SMTPPort)
    $SMTP.EnableSsl = $true
    $SMTP.Credentials = New-Object System.Net.NetworkCredential($SMTPUser, $SMTPPass)
    
    $Mail = New-Object System.Net.Mail.MailMessage
    $Mail.From = $From
    $Mail.To.Add($To)
    $Mail.Subject = "Sending an email via SMTP"
    $Mail.Body = "Sending test email."
    
    
    $SMTP.Send($Mail)

  • Brissie Admin comes alive!

    Welcome to the start of my own personal website.

    I am a systems and security administrator in Brisbane. I’ve got over 10 years’ experience working in IT and during this time I’ve ended up using many scripts which helped me fix, automate or monitor systems.

    I’ve always thought it would be nice to save these somewhere and shared them with everyone else.

    I’ve decided this is the right place to share so the adventure has started.