0
我有下面的代码,“应”勾选框在下次登录时更改本地用户密码,但我不断收到错误。更改密码在下次登录... vbscript
该账户已经创建,并在本地服务器上。
请任何帮助。
由于我们环境中的旧服务器,我必须在vbscript中执行此操作,而不是powershell。
代码:
' get computer name
Set oWshNet = CreateObject("WScript.Network")
sComputerName = oWshNet.ComputerName
'Set Account Testuser Password Expired parameter
Set objUser = GetObject("WinNT:// " & sComputerName & "/Testuser")
objUser.Put "PasswordExpired", 1
objUser.SetInfo
错误:
account.vbs(6,1)(空):网络路径没有被发现。
** * **编辑* ** * ** * ****
想通了:(!感谢谷歌)
Set oShell = CreateObject("WScript.Shell")
Const SUCCESS = 0
sUser = "TestUser"
' get the local computername with WScript.Network,
' or set sComputerName to a remote computer
Set oWshNet = CreateObject("WScript.Network")
sComputerName = oWshNet.ComputerName
Set oUser = GetObject("WinNT://" & sComputerName & "/" & sUser)
oUser.Put "PasswordExpired", 1
oUser.SetInfo
oShell.LogEvent SUCCESS, "Password Attribute Changed"
你应该张贴您的“想通了”编辑作为一个答案,两天后接受的答案。 – HK1 2012-04-13 12:55:18