Scheduled Email Reports of at Risk Users

Configuration Management

Create a file called configuration.txt. There will be 2 entries in this file:

  1. Number of days for which the logs will be evaluated

  2. The automated execution time of the string

    1. If the execution time is 1:12 PM , it will indicate that the script will be automatically run at 1:12 PM everyday.

Write a PowerShell script called Configuration.ps1.

This script will provide a menu with 3 options.

Option 1: Show configuration (configuration should be displayed as pscustomobject) • Option 2: Change configuration o This option will ask the user for new configuration and replace the old configuration with new • Option 3: Exit (to exit the menu)

Input Filtering:

  • Display proper messages to users

  • Menu should not except any input other than 1, 2, or 3.

  • The days should be taken only as digits.

  • The execution time should only be taken in the format digit:digitdigit AM/PM

Script Functions: • readConfiguration • changeConfiguration • configurationMenu

Full Configuration Menu Script!

Powershell Email

  • It will then generate you a password; take a picture of it or put it in a password manager so you don't loose it

Create a script called Email.ps1

Have a function called SendAlertEmail in this script file that will take 1 parameter called $Body.

Email in Inbox

Scheduler

Create a script file called Scheduler.ps1.

Putting it all Together

Create a script file called main.ps1. Use dot notation to include the script files Email.ps1, Scheduler.ps1, Configuration.ps1, and Event-Logs.ps1 (from last week). In main.ps1:

Output of Task Creation

Scheduled Email Working!

Final Scripts

Last updated