S
S
Seli_one2021-10-13 16:47:38
RDP
Seli_one, 2021-10-13 16:47:38

Notifying users about password changes?

There is a terminal server not in the domain. People work on it, once every 90 days they need to change the password, but they ignore system alerts.
Tell me who knows how to make a script with a user notification about the expiration of the password. And so that it does not work about logging into the server, but once every few days a message is issued, so many days are left before the password change.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Seli_one, 2021-10-15
@Seli_one

In general, I figured it out myself. Wrote a bat file and threw it into the scheduler, triggered by user authorization.
Draft :
@echo off
chcp 1251
SetLocal EnableExtensions
net user %username% | findstr /C:"Password expires" >tmp.txt
Set file=C:\Users\dgt.admin\tmp.txt
For /F "usebackq tokens=* delims=" %%i In ("%file%") Do Set var=%%i
:: Write variable to file for testing
Echo %var:~39,-9% >time.txt
set pass=%var:~39,-9%
::echo %pass%
::pause
set now=%date%
echo %now% >> time.txt
::pause
::date /t >> time.txt
set day1=%pass:~0.2%
::echo dey1 %day1%
::
for /f "tokens=* delims=0" %%N in ("%day1%") do set "day1=%%N"
if not defined day1 set "n=0"
::echo %day1%
::pause
set mon1=%pass:~3,-5%
for /f "tokens=* delims=0" %%N in ("%mon1%") do set "mon1=%%N"
if not defined mon1 set "n =0"
::echo %day1%
::echo %mon1%
::pause
set day2=%date:~0.2%
for /f "tokens=* delims=0" %%N in ("%day2%" ) do set "day2=%%N"
if not defined day2 set "n=0"
set mon2=%date:~3,-5%
for /f "tokens=* delims=0" %%N in ("% mon2%") do set "mon2=%%N"
if not defined mon2 set "n=0"
::echo %day2%
::echo %mon2%
::pause
set /A raz1=%day1%-%day2%
::echo %raz1%
::pause
set /A raz2=%mon1%-%mon2%
::echo %raz2%
::pause
if "%raz1%" LEQ 3 if %raz2% EQU 0 (msg %username% "Password needs to be changed")
If If anyone is interested, I'll explain my train of thought.
Thanks

S
Sergey Ryzhkin, 2021-10-13
@Franciz

1. If they ignore the notification, why do you think they won't ignore the notifications?
2. You can write a script with a pop-up window with text in it and throw it into the scheduler so that this task is performed once every 3 months.

I
ikutin666, 2021-10-13
@ikutin666

what about email newsletters?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question