Friday, October 12, 2012 12:07 PM
I copied and pasted a script to automate outlook signatures at logon. I applied through GPO and it works great. Thank you to the person that wrote it.
I have a question about modifying the script. I need for the script to check for an outlook profile when the user logs on, and if the user has never used outlook on that computer, then the script will not run. The problem is when people log in to different computers and haven't setup the outlook profile, they are prompted to setup outlook, and the setup screen just keeps trying. They may not always want to set it up on that computer. I hope i didn't make that too confusing.On Error Resume Next
Set objSysInfo = CreateObject("ADSystemInfo")
Set WshShell = CreateObject("WScript.Shell")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
strName = objUser.FullName
strDepartment = objUser.Department
strTitle = objUser.Title
strCompany = objUser.Company
strCred = objUser.info
strStreet = objUser.StreetAddress
strLocation = objUser.l
strState = objUser.St
strPostCode = objUser.PostalCode
strPhone = objUser.TelephoneNumber
strMobile = objUser.Mobile
strFax = objUser.FacsimileTelephoneNumber
strEmail = objUser.mail
strWeb = objUser.wWWHomePage
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
I am guessing i could use an If then statement in the set objSignature section to ignore the rest of the script and end if a profile doesnt exist? I just don't really know VB. Could anybody help with that statement?
Friday, October 12, 2012 2:14 PMModerator
Exercise: What does the On Error Resume Next statement do, and why might it be a bad idea to put it at the top of your script?
Monday, December 10, 2012 6:52 PMModerator
Do you still need help with this question?
Monday, December 31, 2012 6:33 PMModerator
Let me clarify a bit. This is the place to get help with scripting questions. If you don't understand the code at all, then it's really not the place to ask this kind of question: "Here's a bunch of lines of code that's supposed to do something useful for me. I need to add a specific feature to it, but I don't know programming or scripting at all. Can someone please add this feature for me?"
The problem with this kind of question is that you're basically asking for free consulting work. What happens if the added feature doesn't work as you expect, or if you want to add other features to your script?
For these reasons, it's best to start learning scripting. We all start somewhere. There is a Learn link at the top of this forum that leads to lots of resources. The Windows 2000 Scripting Guide also contains an excellent VBScript primer.
- Marked As Answer by Bill_StewartMicrosoft Community Contributor, Moderator Tuesday, January 22, 2013 9:14 PM