On Error Resume Next
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
strPassword = ""
Set colAccounts = GetObject("WinNT://" & strComputer)
colAccounts.Filter = Array("user")
For Each objUser In colAccounts
objUser.ChangePassword strPassword, strPassword
If Err = 0 or Err = -2147023569 Then
Wscript.Echo objUser.Name & " is using a blank password."
End If
Err.Clear
Next
Wscript.Echo “Over!”
利用系统禁止空密码的策略检测返回值,若成功,说明该帐号密码为空。
引用自:
http://www.microsoft.com/china/technet/community/scriptcenter/resources/hey051006.mspx