• 配置windows自动修改密码和自动登录


    日常运维多台服务器,每季度要修改一次密码,非常麻烦,现做一个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 "HKLMSOFTWAREMicrosoftWindows NTCurrentVersionWinlogonDefaultPassword",pwdstr

    具体部分脚本需要根据实际情况修改,以上是在windows2012上测试通过(2012修改密码不影响计划任务),实际在windows2003上要注意,由于自动修改密码会导致计划任务异常,不一定适用。

    不过以上方法存在一定安全隐患,密码不能手工设置,如需手工设置,可参考如下脚本:
    newchg_pwd.vbs:
    Set objArgs = WScript. Arguments
    For x = 0 to objArgs.Count - 1
    WScript.Echo objArgs(x)
    Next

    strComputer="."

    Set objUser=GetObject("WinNT://" & strComputer & "/Administrator")

    objUser.SetPassword objArgs(0)

    objUser.SetInfo

    Dim OperationReGIStry
    Set OperationRegistry=WScript.CreateObject("WScript.Shell")
    Default=OperationRegistry.RegRead("HKLM")
    OperationRegistry.RegWrite "HKLMSOFTWAREMicrosoftWindows NTCurrentVersionWinlogonDefaultPassword",objArgs(0)
    执行时候只需运行命令:cscript newchg_pwd.vbs newpasswd。此方法较为安全,手工操作,配合自动化代理执行,就可以做到自由设置密码。

    转载于:https://blog.51cto.com/lysweb/2088941

  • 相关阅读:
    区块链分布式云存储项目盘点
    区块链一定要知道的的七大认识误区
    以太坊“空块”数量激增有什么影响?
    区块链技术涉及哪些编程语言?
    一文读懂实用拜占庭容错(PBFT)算法
    清除浮动的影响
    滚动条
    分享侧栏例子
    最最最简单的轮播图(JQuery)
    3D动画
  • 原文地址:https://www.cnblogs.com/twodog/p/12137309.html
Copyright © 2020-2023  润新知