From where/which server do I need to run this script and do I need to run this script on daily basis?
Hello, Robert, thank you for your exptremely useful script. Works ar a charm, except I tried embedding inline images as shown here: https://www.youtube.com/watch? v=iwvQ5tPqgW0 but I can't seem to be able to have the image to show. The attachment is there, the image's placeholder is there, but it doesn't show. I'm simply using $image1 = "\\fileserver\l ogo.png" In the body I have: <img src=""ser.png"" height=""102"" width=""215""> and then along the comman parameters: -attachments $image1 Do you have any insight? Thank you ever so much
I actually have logo.png in the html, sorry for the typo, I just failed at generalising the filenames :)
it should be like this, $image1 = "\\fileserver\logo.png" <img src=""$image1"" height=""102"" width=""215""> -attachments $image1
Hello, Thank you for the great Script. I got an issue: I'm using office 365. By reading a previous post they mentioned that I needed to add -port 587 -UseSsl to smtp.office365.com. Can you please advise? thank you ! Script Loaded *** Settings Summary *** SMTP Server : smtp.office365. com -port 587 -UseSsl Expire in Days : 14 From : XXX@domain.com Logging : False Log Path : Testing : False Test Recipient : Report Recipient : Intervals :
Secondly, Is it possible to configure in the script with these fields? SMTP Server Expire in Days From To avoid to do this manually
We use office 365 also. The setting we use is "domain-com.mail.protection.ou tlook.com" example "acme-com.mail. protection.outl ook.com" If you have already authorized the IP to send mail through O365, and you SPF you should be all set. We had issues getting the direct send, and had to opt for option 2 in the link below. https://docs.mi crosoft.com/en- us/exchange/mai l-flow-best-pra ctices/how-to-s et-up-a-multifu nction-device-o r-application-t o-send-email-us ing-office-3 The script has the fields SMTP Server Expire in Days From Look in in the top section between lines 13 and 21
You need to add it on the Send-MailMessage line. not in the smtpserver address.
I would like to use this script in another manner, but not sure how to get it to populate for Expired accounts. Our contractor accounts expire every XX days. It would be nice if their was a sript that looked Account Expiration, and a Custom AD Attribute. The custom AD attribute would be the contractors manager, they would get a notice that their contractor's account is about to expire, and that they need to put a request into extend the account. Query for expiring account Get-ADUser -Filter 'enabled -eq $true' -Properties AccountExpirationDate | Select sAMAccountName, AccountExpirati onDate
I am trying to use an html message and I am not getting the <mark> command to work I can use <h1> <h2> and <strong> tags, however, <mark> does not work? Should it? What am I missing? My HTML works otherwise. Below is snip of parts of the message format. This works as HTML, obliviously a few changes, but otherwise it is good. Example $body =" <font face=""verdana""> Dear $name, <P> You are receiving this notice because <strong><mark>S ection 2</strong></mar k> Working over VPN\Traveling<b r> <p> Disconnect from VPN and then reconnect using your new password.<br> <br> <h1> Password Reset Tool </h1> Login to <a href=""https:// someURL/owa"">P assword Reset Tool</a> Step for detail, Additional detail here. <br> <p> Thanks, <<mark>Highligh tme</mark> </P>"
I just wanted to add to my earlier post... the example I gave shows <<mark>... I cannot edit my post, but it should read <mark>Highlightme</mark>
Your mail client may not support <h> tags. Try editing the text using <font> instead.
H Tags work. The Highlight tag does not. Office 365 \ Outlook client.
Sorry, I called it Highlight, but the tag that does not work is the <mark> tag.
I am trying to run the 2.9 version of the script. I want to specify a non-standard SMTP port for my SMTP server. I don't see a parameter for SMTP port, nor do I see any other place in the script to configure this value. Anyone know how to do this?
You can edit the Send-MailMessage lines directly to change your SMTP port.
Thanks Morn77! Now I have another question; can I run it as test before I setup the schedule? If so do I run it from the scripts folder with my parameters?
I am using the new version of the script. An example of what is happening is this: on the line where it asks for the $expiredays, I enter 15 after the comma but I get the error; Missing ')' parameter in the function list
Dont change anything in the script unless you want to point to one group (ou) and not all users
I am very new to PS scripting so excuse the simple question. How do I enter the values for smtpServer, expiry days, and From email in the script so it won't prompt every time it runs. Tanks.
You dont write them in the script, you write them when you run the script.. EXAMPLE PasswordChangeNotification.ps1 -smtpServer mail.domain.com -expireInDays 21 -from "IT Support <support@domain .com>" -reportTo myaddress@domai n.com
Hi can someone help me understanding why my output looks like the below? UserName Name EmailAddress PasswordSet DaysToExpire ExpiresOn SendMail Name, Name Email@Email.dk 8/17/2019 14:00 -73 8/17/2019 14:00 OK But look at the password set and DaysToExpire and ExpiresOn?? Something is wrong... I'm using the group solution and not users...
Oh, I can see our password policy says MaxPasswordAge : 00:00:00... Could I change the script so it knows that our MaxPasswordAge is 90 days? or should I change the MaxPasswordAge on my domain?