PDA

View Full Version : What am i doing wrong



t_jolt
Tue Oct 14th, 2008, 12:26 PM
Here i go again trying script something... but i can seem to get the script to bind from ad. whats wrong? any help would be appreciated


strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://mickey.hfp.com:389/DC=hfp,DC=com" & strUser)

Thanks
Tyrel

mclarke
Tue Oct 14th, 2008, 12:57 PM
Tyrel, what are you trying to accomplish in the long run? Grab a user object?

t_jolt
Tue Oct 14th, 2008, 01:12 PM
yeah, boss wants a standard email sig

McVaaahhh
Tue Oct 14th, 2008, 01:12 PM
Here i go again trying script something... but i can seem to get the script to bind from ad. whats wrong? any help would be appreciated


strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://mickey.hfp.com:389/DC=hfp,DC=com" & strUser)

Thanks
Tyrel

Not sure in script language, but if you're trying to put two strings together shouldn't you be using the + operator? In my world the & is a bitwise operator and your call should be:



strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://mickey.hfp.com:389/DC=hfp,DC=com" + strUser)

t_jolt
Tue Oct 14th, 2008, 01:12 PM
here is what i have so far - vbs script

On Error Resume Next

Set objSysInfo = CreateObject("ADSystemInfo")

strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://mickey.hfp.com:389/dc=hfp,dc=com" & strUser)

strName = objUser.FullName
strTitle = objUser.Title
strCompany = ("Company Name")
strPhone = objUser.telephoneNumber
strWeb = ("website")

Set objWord = CreateObject("Word.Application")

Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection

Set objEmailOptions = objWord.EmailOptions
Set objSignatureObject = objEmailOptions.EmailSignature

Set objSignatureEntries = objSignatureObject.EmailSignatureEntries

objSelection.TypeText strName
objSelection.TypeParagraph()
objSelection.TypeText strTitle
objSelection.TypeParagraph()
objSelection.TypeText strPhone
objSelection.TypeParagraph()
objSelection.TypeText strCompany
objSelection.TypeParagraph()
objSelection.TypeText strWeb

Set objSelection = objDoc.Range()

objSignatureEntries.Add "AD Signature", objSelection
objSignatureObject.NewMessageSignature = "AD Signature"

objDoc.Saved = True
objWord.Quit

t_jolt
Tue Oct 14th, 2008, 01:18 PM
And for some strange reason it wont connect to AD, i dont know why, the port is open, and i believe that my ldap url format is correct. thats the only part thats starting to frustrate me.

mclarke
Tue Oct 14th, 2008, 01:20 PM
Is your AD set to allow LDAP queries?

mclarke
Tue Oct 14th, 2008, 01:23 PM
Also, have you tried this to grab the username?

Set objUser = GetObject(”LDAP://” & strUser)

t_jolt
Tue Oct 14th, 2008, 01:26 PM
ad is set to allow ldap querys and i have tried pointing directly to the user

mclarke
Tue Oct 14th, 2008, 01:41 PM
You basing your sig off of this.

http://technet.microsoft.com/en-us/magazine/cc160913.aspx

t_jolt
Tue Oct 14th, 2008, 01:42 PM
yup

t_jolt
Tue Oct 14th, 2008, 01:43 PM
its probably something stupid, i just wanted to make sure that my ldap format wasnt all goofed up

mclarke
Tue Oct 14th, 2008, 01:44 PM
Whats funny is I just tried that exact example, it works fine here.

t_jolt
Tue Oct 14th, 2008, 01:47 PM
yeah i dont know what the hell is going on, i have set ad to allow anonymous logon full read permissions and its still not working

mclarke
Tue Oct 14th, 2008, 01:49 PM
What does it return if anything?

TurboGizzmo
Tue Oct 14th, 2008, 01:49 PM
You basing your sig off of this.

http://technet.microsoft.com/en-us/magazine/cc160913.aspx

Mmm must add this to my list of things to do, good link thanks!

mclarke
Tue Oct 14th, 2008, 01:51 PM
wow! all i gotta say on this one...

http://cwashington.netreach.net/depo/view.asp?Index=1123

t_jolt
Tue Oct 14th, 2008, 01:51 PM
nothing just puts in my company name, and website cause i hard coded it.
so something has to be going on with ad. cause it should be working

t_jolt
Tue Oct 14th, 2008, 01:53 PM
wow! all i gotta say on this one...

http://cwashington.netreach.net/depo/view.asp?Index=1123

yeah saw that one too. thats crazy