2022/10/19

發信通知AD帳號 密碼快到期的人

 windows系統內建的提醒實在太小了,就縮在右下角,而且預設兩週前會天天提醒,到剩一週後,就不會在顯示了,使用者早就忘了,所以需要一個比較顯示的提示。

 可以參考這個下列這個powershell,就可以執到此功能,裡面程式碼有夠多,但只要先把要搜尋的dc位置,mail server位置,管理者信箱這3個設定值,調成自己環境內的資訊,就可以執行測試了。

預設是測試模式,所以只會寄給管理者,測試ok後再關閉測試模式,通知信就會發給使用者了,不需要修改太多東西就可以用了,讚。

https://gist.github.com/meoso/3488ef8e9c77d2beccfd921f991faa64#file-example-com-password-expiration-notifications-ps1



Notifying Users of Expiring Passwords via Email in Active Directory

The default built-in password reminder in Windows is quite inconspicuous, residing in the bottom right corner. Additionally, it only displays reminders every day up to two weeks before the expiration date. Once there is only one week left, the reminder disappears, and users tend to forget about it. Therefore, a more prominent notification is needed.

You can refer to the following PowerShell script to achieve this functionality. Although the code may seem extensive, you only need to adjust three configuration values: the location of the domain controller (DC), the mail server, and the administrator's email address. Once you set them according to your environment, you can execute a test run.

By default, the script runs in test mode, sending notifications only to the administrator. After confirming that it works correctly, you can disable test mode, and the notifications will be sent to the users. It requires minimal modifications, making it easy to use.

You can find the PowerShell script at the following link:

https://gist.github.com/meoso/3488ef8e9c77d2beccfd921f991faa64#file-example-com-password-expiration-notifications-ps1

沒有留言:

張貼留言