标签:自动化改密
日常运维多台处事器,每季度要改削一次暗码,非常麻烦,现做一个VBS脚本,每季度第一天按时运行,则可解决该问题,具体实现脚本如下:autochg_pwd.vbs
ystr=year(Now)
mstr=Month(Now)
if len(mstr)<2 then mstr="0"&mstr
dstr=day(Now)
if mstr="01" then mstr="!"
if mstr="02" then mstr="!"
if mstr="03" then mstr="!"
if mstr="04" then mstr="@"
if mstr="05" then mstr="@"
if mstr="06" then mstr="@"
if mstr="07" then mstr="#"
if mstr="08" then mstr="#"
if mstr="09" then mstr="#"
if mstr="10" then mstr="$"
if mstr="11" then mstr="$"
if mstr="12" then mstr="$"
pwdstr="testpwd"&ystr&mstr
strComputer="."
Set objUser=GetObject("WinNT://" & strComputer & "/Administrator")
objUser.SetPassword pwdstr
objUser.SetInfo
Dim OperationReGIStry
Set OperationRegistry=WScript.CreateObject("WScript.Shell")
Default=OperationRegistry.RegRead("HKLM\")
OperationRegistry.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword",pwdstr
具体部分脚本需要按照实际情况改削,以上是在windows2012上测试通过(2012改削暗码不影响打算任务),实际在windows2003上要注意,由于自动改削暗码会导致打算任务异常,,不必然适用。
配置windows自动改削暗码和自动登录
标签:自动化改密