Login | |
|
 |
Change Password VBScript with HTML Form - 10/18/2006 12:58:13 AM
|
|
 |
|
| |
Ivo
Posts: 4
Score: 0
Joined: 10/18/2006
Status: offline
|
Hi everyone the idea of what I need is an Html Form so users can change their Outlook Password cause the Exchange Server is not hosted with the domain localy (don`t ask me why). So everytime an user changes his Logon Password he wants to change his Outlook Password too on the Exchange Server. I created an HTML Form and also an VBSCript that changes the Password. The VBScript is working fine standalone, but together with the html Form I always get an error that "ActiveX component can`t create object". Can somebody help me? Here is the Script: <html> <form> <h1>Change Password</h1> <table border="0" cellpadding="3" cellspacing="3"> <tr> <td>User Name:</td> <td><INPUT type="text" name="Account"><BR></td> </tr> <tr> <td>Old Password :</td> <td><INPUT type="password" name="OldPassword"><BR></td> </tr> <tr> <td>New Password :</td> <td><INPUT type="password" name="newPassword"><BR></td> </tr> <tr> <td>Confirm Password:</td> <td><INPUT type="password" name="confirmPassword"><BR></td> </tr> <tr> <td><input type=button id=ChangePassword Value="Change Password"></td> </tr> </table> </form> <--------------- VBSCript --------------------> <script type="text/vbscript"> Sub ChangePassword_OnClick dim oldPassword, newPassword, Account, confirmPassword Dim WSHNet, UserObject, oWinNT, domain Set WshShell = WScript.CreateObject("WScript.Shell") 'Account = "xptest02" 'oldPassword = "Test11!" 'newPassword = "Test22!" 'confirmPassword = "Test22!" domain = "10.8.10.2" if newPassword <> confirmPassword then Msgbox "The confirmation password does not match the new password" exit sub end if Set WSHNet = WScript.CreateObject("WScript.Network") Set oWinNT = GetObject("WinNT:") Set UserObject = oWinNT.OpenDSObject("WinNT://" & domain & "/" & Account, Account, oldPassword , 1) if err <> 0 Then Msgbox "User '" & Account & "' on '" & domain & " not found." showError "Error #" & err.number & ": " & err.description exit sub end if UserObject.changePassword oldPassword, newPassword if err <> 0 then Msgbox "Could not change password for user '" & Account & " You may not have sufficient privileges, " &_ "or you may have input an incorrect current password." exit sub end if Msgbox "Password changed" ' msgbox err.number & " " & err.description Set WSHNet = Nothing Set UserObject = Nothing End Sub </script> </html>
|
|
| |
|
|
|
 |
RE: Change Password VBScript with HTML Form - 10/18/2006 3:48:14 AM
|
|
 |
|
| |
TNO
Posts: 1247
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
Somewhere deep in my pockets somewhere I have something that will make WScript available to hta's ....lets see (has a habit of writing replies before having an answer ) Here it is. The CLSID of the scripting host object. This used to be a big issue back when IE5 was about and scriptlets were the new kid on the block causing security issues all-round <object id='wsh' classid='clsid:F935DC22-1CF0-11D0-ADB9-00C04FD58A0B'></object> <button onclick="wsh.Run('c:\\FormFlow\\DFFILL.EXE')">command</button>
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: Change Password VBScript with HTML Form - 10/18/2006 6:11:48 AM
|
|
 |
|
| |
mbouchard
Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
|
Maybe I missed it, but is this for HTA or HTML?
_____________________________
Mike For useful Scripting links see the Read Me First stickey! Always remember Search is your friend.
|
|
| |
|
|
|
 |
RE: Change Password VBScript with HTML Form - 10/19/2006 1:11:54 AM
|
|
 |
|
| |
TNO
Posts: 1247
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
Just place <object id='wsh' classid='clsid:F935DC22-1CF0-11D0-ADB9-00C04FD58A0B'></object> Anywhere inside the <body></body> Everything in your script that requires WScript replace with wsh
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: Change Password VBScript with HTML Form - 10/22/2006 7:19:44 PM
|
|
 |
|
| |
Ivo
Posts: 4
Score: 0
Joined: 10/18/2006
Status: offline
|
Hmm...... Something is still wrong. now i get an error " Line 38, Object required 'wsh' ", even i pasted <object id='wsh' classid='clsid:F935DC22-1CF0-11D0-ADB9-00C04FD58A0B'></object> as u said. Line 38 is Set WshShell = wsh.CreateObject("wsh.Shell") ---------------------------------------------- <html> <body> <form> <h1>Change Password</h1> <table border="0" cellpadding="3" cellspacing="3"> <tr> <td>User Name:</td> <td><INPUT type="text" name="Account"><BR></td> </tr> <tr> <td>Old Password :</td> <td><INPUT type="password" name="OldPassword"><BR></td> </tr> <tr> <td>New Password :</td> <td><INPUT type="password" name="newPassword"><BR></td> </tr> <tr> <td>Confirm Password:</td> <td><INPUT type="password" name="confirmPassword"><BR></td> </tr> <tr> <td><input type=button id=ChangePassword Value="Change Password"></td> </tr> <object id='wsh' classid='clsid:F935DC22-1CF0-11D0-ADB9-00C04FD58A0B'></object> </table> </form> </body> <--------------- VBSCript --------------------> <script type="text/vbscript"> Sub ChangePassword_OnClick dim oldPassword, newPassword, Account, confirmPassword, wsh Dim WSHNet, WshShell, UserObject, oWinNT, domain Set WshShell = wsh.CreateObject("wsh.Shell") 'Account = Inputbox("Geben Sie Ihren Outlook Benutzernamen ein","Eingabe") 'oldPassword = Inputbox("Geben Sie das alte Kennwort ein","Eingabe") 'newPassword = Inputbox("Geben Sie das neue Kennwort ein","Eingabe") 'confirmPassword = Inputbox("Bestätigen Sie das neue Kennwort ","Eingabe") domain = "10.8.10.2" if newPassword <> confirmPassword then Msgbox "The confirmation password does not match the new password" exit sub end if Set WSHNet = wsh.CreateObject("wsh.Network") Set oWinNT = GetObject("WinNT:") Set UserObject = oWinNT.OpenDSObject("WinNT://" & domain & "/" & Account, Account, oldPassword , 1) if err <> 0 Then Msgbox "User '" & Account & "' on '" & domain & " not found." showError "Error #" & err.number & ": " & err.description exit sub end if UserObject.changePassword oldPassword, newPassword if err <> 0 then Msgbox "Could not change password for user '" & Account & " You may not have sufficient privileges, " &_ "or you may have input an incorrect current password." exit sub end if Msgbox "Passwort erfolgreich geändert" ' msgbox err.number & " " & err.description Set WSHNet = Nothing Set UserObject = Nothing End Sub </script> </html>
|
|
| |
|
|
|
 |
RE: Change Password VBScript with HTML Form - 10/22/2006 9:15:17 PM
|
|
 |
|
| |
TNO
Posts: 1247
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
Interesting. I'm not sure if there was a security updatre that completely disabled this control or what. Try ebgreen's idea to see if it will work. CreateObject("WScript.Shell") Put <script></script> in the head tags, and delete the <object> tab
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
|
|