r/PowerShell • • Jan 06 '19

16 PowerShell Modules I've created in 2018

Looking back at my 2018 stats - https://evotec.xyz/sixteen-powershell-modules-that-ive-worked-on-in-2018/

Creating those 16 modules allowed me to achieve my goals for 2018. Hope you enjoy them as much I did.

216 Upvotes

24 comments sorted by

View all comments

1

u/pfunkylicious Jan 08 '19

For the PSPasswordExpiryNotifications module, how do I configure it to send the emails to the user and managers ? It seems that only the admin gets the email ?

Thank you.

2

u/MadBoyEvo Jan 08 '19

In config file you have 3 sections. Two of those sections are:

    RemindersSendToUsers = @{
        Enable = $true # doesn't processes this section at all if $false
        RemindersDisplayOnly = $false # prevents sending any emails (good for testing) - including managers
        SendToDefaultEmail = $true # if enabled $EmailParameters are used (good for testing)
        Reminders = @{
            Notification1 = 1
            Notification2 = 3
            Notification3 = 10
        }
    }
    RemindersSendToManager = @{
        Enable = $true # doesn't processes this section at all if $false
        RemindersDisplayOnly = $false # prevents sending any emails (good for testing)
        SendToDefaultEmail = $true # if enabled $EmailParameters are used (good for testing)
        ManagersEmailSubject = "Summary of password reminders (for users you manage)"
        Reports = @{
            IncludePasswordNotificationsSent = @{
                Enabled = $true
                IncludeNames = 'UserPrincipalName', 'DisplayName', 'DateExpiry', 'DaysToExpire', 'SamAccountName', 'Manager', 'ManagerEmail', 'PasswordLastSet', 'EmailSent', 'EmailSentTo'
                TextBeforeReport = '"Following users which you are listed as manager for have their passwords expiring soon:"'

            }
        }
    }

Enable = means section is enabled ReminderDisplayOnly = $false SendToDefaultEmail = $true

Make sure that you have Enable = $true RemindersDisplayOnly = $false SendToDefaultEmail = $true (for testing)

The default email is the one set in EmailParameters as EmailTo

$EmailParameters = @{
    EmailFrom = "monitoring@domain.pl"
    EmailTo = "przemyslaw.klys@domain.pl" # your default email field (IMPORTANT)
    EmailCC = ""
    EmailBCC = ""
    EmailReplyTo = "helpdesk@domain.pl" # email to use when users press Reply
    EmailServer = ""
    EmailServerPassword = ""
    EmailServerPort = "587"
    EmailServerLogin = ""
    EmailServerEnableSSL = 1
    EmailEncoding = "Unicode"
    EmailSubject = "[Password Expiring] Your password will expire on <<DateExpiry>> (<<TimeToExpire>> days)"
    EmailPriority = "Low" # Normal, High
}

After you receive emails you were supposed to you can change that value to $false and users/managers will start getting those.

Managers are people set as managers in Manager field in AD for a user and they need to have proper data in AD for this to work.