→ 🚀What's New? Explore Lansweeper's Fall 2024 Updates! Fall Launch Blog !

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
MarcoT
Engaged Sweeper II

Hi,
since some users are always out of the domain and we would like to avoid their password expiring (after which they can no longer connect to the VPN) I would like to know if there is a possibility to create a report that tells the users whose password is about to expire.
It would also be nice to have the possibility to automate a notification email to the user whose password is expiring reminding them to change it before the expiration date.

Unfortunately, being always in the VPN, they never receive the Windows warning that the password is about to expire.

Thanks

1 ACCEPTED SOLUTION
mmwend
Engaged Sweeper III

You can try to edit the "Send-Mailmessage" line to include "-UseSSL" option as:

Send-MailMessage -smtpServer $smtpserver -UseSsl -From ......

 Note the-Usessl difference.

 

View solution in original post

6 REPLIES 6
mmwend
Engaged Sweeper III

I have renamed the original files as ...txt

Unzip these 2 file.
Rename this PasswordNoticeBAT.txt to PasswordNotice.bat
Rename this PasswordNotice.PS.txt to PasswordNotice.PS1

Edit the .PS1 file to your liking and make a test with it to make sure it works and the verbiage for you is correct.
Edit the BAT to confirm.
Can run the BAT file manually for testing.
Copy these to a folder on a server, and schedule it as a task to run the BAT file.

I hope this helps...

MarcoT
Engaged Sweeper II

I'm trying, but it asks me to enable STARTTLS. Do you know how I can do it?

mmwend
Engaged Sweeper III

You can try to edit the "Send-Mailmessage" line to include "-UseSSL" option as:

Send-MailMessage -smtpServer $smtpserver -UseSsl -From ......

 Note the-Usessl difference.

 

MarcoT
Engaged Sweeper II

I get an error message, I think I'm missing some parameter:

Send-Mailmessage : The SMTP server requires a secure connection or the client has not been authenticated. Server response: 5.7.57 Client not authenticated to send mail. [ZR0P278CA0065.CHEP278.PROD.OUTLOOK.COM 2024-10-28T10:05:34.873Z 08DCF67874864C95] In C:\Users\m.trezzi\Desktop\Psw Expiration Notice\PasswordNotice.ps1:113 char:9 + Send-Mailmessage -smtpServ er $smtpServer -UseSSL -da $da ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage], SmtpExcept ion + FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage

 

For example, where do you set the password for SMTP access?

mmwend
Engaged Sweeper III

I was in the same boat a while back. VPN passwords would expire and the users would have to call the service desk to have to reset their passwords.

Unfortunately, I resolved this lack of notification using a PowerShell script.
All users now get a notice every day if their password is less than 9 day of expiration date.
The script is scheduled on a Domain Controller to run once a day.

(It would amaze you to learn how many users wait for the last day before changing their passwords, even with no VPN)

If this can be scheduled in Lansweeper, I'd might be interested. I do like the flexibility of the custom email message, text, etc in the PS script though.

 

 

MarcoT
Engaged Sweeper II

@mmwend On lansweeper it would be great.
Otherwise can you share the script with the related usage guide?