An update to my previous post. That script doesn't quite work. Unless the
value is changing, the events won't be triggered. Here's an updated script
that I just used on my DC to rotate that log out. I mentioned that 20
iterations will rotate the log out. It will only do that if the new log was
over the 1Mb log file threshold. So run the script as is (10 iterations)
and then go delete the large logfile.
!!!This will set your max password age to a setting other than your current
setting!!! It will determine your current setting, and then alternate
setting your max password age between your current value + 1 and your
current value. It will finish by setting it back to your current value so
you shouldn't see any issues. Because it increments the value, domain users
won't have the new value applied to them.
N
<BatchFile>
@echo off
setlocal
set MAXPWAGE=
for /f "usebackq tokens=1,5" %%i IN (`net accounts`) DO (
if %%i.==Maximum. (
set MAXPWAGE=%%j
)
)
if NOT defined MAXPWAGE goto ErrorIt
set /A MAXPWAGEPP=%MAXPWAGE%+1
for /l %%k IN (1,1,5) DO (
net accounts /MAXPWAGE:%MAXPWAGEPP%
net accounts /MAXPWAGE:%MAXPWAGE%
)
goto EndIt
:ErrorIt
echo ERROR!!!
:EndIt
Endlocal
</BatchFile>
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm