VBS登录脚本无法正常运行

时间:2010-10-15 14:52:48

标签: vbscript registry

我有一个用于检查注册表项的登录脚本,如果找不到该项,则会运行一个脚本,该脚本会从AD中的信息创建Outlook签名,然后向注册表添加一个密钥。该脚本在我测试过的大约20台机器上完美运行,但它在3台机器上无法正常工作。对于这3台机器,它通过了reg键的检查,然后启动了sigcreate脚本,但跳过了实际的创建,只是添加了reg键。我错过了什么吗?

On Error Resume Next

Set objSysInfo = CreateObject("ADSystemInfo")

Set WshShell = CreateObject("WScript.Shell")

strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)

strName = objUser.FullName
strTitle = objUser.Description
strCred = objUser.info
strStreet = objUser.StreetAddress
strLocation = objUser.l
strPostCode = objUser.PostalCode
strPhone = objUser.TelephoneNumber
strMobile = objUser.Mobile
strFax = objUser.FacsimileTelephoneNumber
strEmail = objUser.mail

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.Font.Name = "Arial"
objSelection.Font.Size = 11
if (strCred) Then objSelection.TypeText strName & ", " & strCred Else 
objSelection.TypeText strName
objSelection.TypeParagraph()
objSelection.TypeText "   " & strTitle
objSelection.TypeText Chr(11)
objSelection.TypeText "    " & strPhone
objSelection.TypeText Chr(11)
objSelection.TypeText Chr(11)
objSelection.TypeText "Company Name"
objSelection.TypeText Chr(11)
objSelection.TypeText "Company Tagline"
objSelection.TypeText Chr(11)
objSelection.TypeText Chr(11)
objSelection.TypeText "Company Website"



Set objSelection = objDoc.Range()

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

objDoc.Saved = True
objWord.Quit

Set oShell = CreateObject("Wscript.Shell") 

sRegFile = "\\file1\users\Clerical\wallpaper\siglock.reg"
oShell.Run "regedit.exe /s " & Chr(34) & sRegFile & Chr(34), 0, True

1 个答案:

答案 0 :(得分:0)

问题解决了....显然在这3台机器上有一些Word 2000的残余......我清理了它并修复了我的问题