|
-
Jun 1st, 2007, 03:56 PM
#1
Thread Starter
New Member
Help! (Long Post, but I'm desperate)
Hello everyone, first time poster and a first time "VB" user. I guess you could call me that. Let me preface my problem with a few things:
- I'm an IT worker, but by no means a programmer
- I've taken precisely one class in programming, and it was Java (last year)
- I'm using Notepad to create VBScripts to help our summer at a K-12 School district easier by making a self-service password reset script.
So here I go... I've been working all week on a Password Reset script, and I can't do it anymore. I've googled the world over, and I've managed to throw together a script that will almost do the trick.
However, this script is just part of my main script that will reset the passwords. This segment--I segmented my script into parts, to ensure each part was working properly (and this is the part that doesn't work) is supposed to retrieve a name,via InputBox, and match/resolve it with the user name in the active directory via LDAP, and then continue with the rest of the script (not pictured) to reset the password. I don't know what else to explain, so I'm just throwing the script there, and praying that a kind soul can correct my error(s). I always assume any error I make is a small oversight.
A few more notes about our network...
- We have a domain called STUDENT, where our student accounts are stored. STUDENT is a part of our domain, BRIDGECITYISD.com.
- Hanz Magoo (username scheme: hanz.magoo) is a theoretical user, and more or less an inside joke with my co-workers. He is the account in question that we would like to reset.
- I've had so many errors, but I've changed so much that previous errors don't show up, but the error that occurs with this exact version is on Line 33, "An Operations Error Occurred." Code: 80072020.
So without further ado, here she is:
call_ldap_name.vbs
-------------------------
vb Code:
Option Explicit
Dim objOU, objUser, objUserName, objRootDSE
Dim strContainer, strDNSDomain, strPassword, strLastName, strFirstName, strMyName, strLDAPName
Dim intCounter, intAccValue, intPwdValue, intpwdLastSet, intAnswer
strContainer = "OU=High School,DC=Student,DC=bridgecityisd,DC=com"
strPassword = "l33tsauce@"
intAccValue = 544
intPwdValue = 0
strLastName = ""
strFirstName = ""
strLDAPName = ""
strFirstName = InputBox ("Enter your First Name:")
strLastName = InputBox ("Enter your Last Name:")
strMyName = strFirstName & "." & strLastName
WScript.echo "UserName is: " & strMyName
WScript.echo "Script Will Now Attempt to Resolve Name to LDAP"
WScript.sleep 1500
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("DefaultNamingContext")
strContainer = strContainer & strDNSDomain
set objOU = GetObject("LDAP://ou=High School,dc=student,dc=bridgecityisd,dc=com")
'Wscript.echo "objOU is: " & objOU
strLDAPName = strLDAPName & strLastName &", "& strFirstName
Wscript.echo "Unresolved LDAP Name is: " & strLDAPName
Set objUser = GetObject("LDAP://cn=strLDAPName,ou=strContainer")
WScript.echo "Resolved LDAP UserName is: " & objUser.CN
WScript.quit
------------------
Last edited by Hack; Jun 2nd, 2007 at 04:48 AM.
Reason: Added VB Highlight Tags
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|