on error resume next
set outstreem=wscript.stdout
if (lcase(right(wscript.fullname,11))="wscript.exe") then
set objShell=wscript.createObject("wscript.shell")
objShell.Run("cmd.exe /k cscript //nologo "&chr(34)&wscript.scriptfullname&chr(34))
wscript.quit
end if
if wscript.arguments.count<5 then
usage()
wscript.echo "Not enough parameters."
wscript.quit
end if
ipaddress=wscript.arguments(0)
username=wscript.arguments(1)
password=wscript.arguments(2)
ntlm=wscript.arguments(3)
port=wscript.arguments(4)
if not isnumeric(ntlm) or ntlm<0 or ntlm>2 then
usage()
wscript.echo “The value of NTML is wrong.”
wscript.quit
end if
if not isnumeric(port) then
usage()
wscript.echo “The value of port is wrong.”
wscript.quit
end if
usage()
outstreem.write “Conneting “&ipaddress&”….”
set objlocator=createobject(”wbemscripting.swbemlocator”)
set objswbemservices=objlocator.connectserver(ipaddress,”root/default”,username,password)
showerror(err.number)
outstreem.write “Setting NTLM=”&ntlm&”….”
set objinstance=objswbemservices.get(”stdregprov”)
set objmethod=objinstance.methods_(”SetDWORDvalue”)
set objinparam=objmethod.inparameters.spawninstance_()
objinparam.hdefkey=&h80000002
objinparam.ssubkeyname=”SOFTWARE\Microsoft\TelnetServer\1.0〃