For those that don't want to get into this MSAgent business (thingy) - here's a "pure" IE script that will reset account passwords.
Well OK - it won't actually reset them yet - I'll be incorporating ADSI to do that later !
I could use some help though. How would one set the property of a tbox so that typed text is "hidden" like "*******" ? I'm sure it can be done. Any HTML wizards out there ?
code:
break on
$false = 0
$true = -1
$ie = olecreateobject ( "internetexplorer.application" )
if $ie = 0
exit
endif
; $rs = setconsole ( "minimize" )
$htmDialog = '<html>' +
'<head><title>Password Reset</title><style>'+
'<!---body{ background-color: silver; color: black;'+
'font-family: tahoma, arial; font-size: 10pt; margin: 3px "'+
'input.tbox { border: lpx black solid;}'+
'td { font: 10pt tahoma; }'+
'---></style></head>'+
'<body scroll=no onresize="window.resizeto(240,120);">'+
'<table align=center><form name=frm>'+
'<tr><td align=right>Domain: </td><td colspan=2 >'+
' <input id=domain name=domain value="%userdomain%" class=tbox></td></tr>' +
'<tr><td align=right>Username: </td><td colspan=2>'+
' <input id=username name=username value="%username%" class=tbox></td></tr>' +
'<tr><td align=right>Password: </td><td colspan=2>'+
' <input id=password type=password name=password value="password" class=tbox></td></tr>' +
'<tr><td align=right>Confirm: </td><td colspan=2>'+
' <input id=confirm type=password name=confirm value="confirmation" class=tbox></td></tr>' +
'<tr><td> </td><td>'+
'<input id=reset type=button value=" Reset "' +
' onclick="frm.status.value=1">'+
'<input type=hidden id=status name=status value=0></td>'+
'<td align=right> <input id=close type=button value=" Close "'+
' onclick="frm.status.value=2"> </td></tr>'+
'</form></table> ' +
'</body>'+
'</html>'
$rs = oleputproperty ( $ie, "addressbar", "s", "$false" )
$rs = oleputproperty ( $ie, "menubar", "s", "$false" )
$rs = oleputproperty ( $ie, "toolbar", "s", "$false" )
$rs = oleputproperty ( $ie, "statusbar", "s", "$false" )
$rs = oleputproperty ( $ie, "resizeable", "s", "$false" )
$rs = oleputproperty ( $ie, "top", "s", "100" )
$rs = oleputproperty ( $ie, "left", "s", "275" )
$rs = oleputproperty ( $ie, "height", "s", "200" )
$rs = oleputproperty ( $ie, "width", "s", "300" )
$rs = olecallfunc ( $ie, "navigate", "s", "about:blank" )
while olegetproperty ( $ie, "busy" ) <> "0" loop
$doc = val ( "&" + olegetproperty ( $ie, "document" ))
$rs = olecallfunc ( $doc, "open" )
$rs = olecallfunc ( $doc, "write", "s", "$htmDialog" )
$rs = oleputproperty ( $ie, "visible", "s", "$true" )
$oStatus = val ( "&" + olecallfunc ( $doc, "GetElementById", "s", "status" ) )
$oDomain = val ( "&" + olecallfunc ( $doc, "GetElementById", "s", "domain" ) )
$oUsername = val ( "&" + olecallfunc ( $doc, "GetElementById", "s", "username" ) )
$oPassword = val ( "&" + olecallfunc ( $doc, "GetElementById", "s", "password" ) )
$oConfirm = val ( "&" + olecallfunc ( $doc, "GetElementById", "s", "confirm" ) )
; Enter command loop ...
while @error = 0
sleep 1
$mStatus = olegetproperty ( $oStatus, "value" )
select
case $mStatus = "1"
gosub resetPassword
case $mStatus = "2"
goto finish
endselect
$rs = oleputproperty ( $oStatus, "value", "s", "0" )
loop
:finish
$rs = olecallfunc ( $doc, "close" )
$rs = olereleaseobject ( $doc )
$rs = olecallfunc ( $ie, "quit" )
$rs = olereleaseobject ( $ie )
exit
:resetPassword
?
?"domain = " olegetproperty ( $oDomain, "value" )
?"username = " olegetproperty ( $oUsername, "value" )
?"password = " olegetproperty ( $oPassword, "value" )
?"confirm = " olegetproperty ( $oConfirm, "value" )
return
Shawn.