I have 7 computers that have bswusctx in the name bswusctx01, 02 etc..
I need code in the the script that will not run if it sees these computernames. It a basic Outlook Signature script like so.
On Error Resume Next
Dim objFSO, copyFile, vSystemDrive
Set WshShell = WScript.CreateObject("Wscript.Shell")
vAPPDATA = WshShell.ExpandEnvironmentStrings("%APPDATA%")
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFolder(vAPPDATA & "\microsoft\signatures\*.*")
objFSO.DeleteFile(vAPPDATA & "\microsoft\signatures\*.*")
Set objSysInfo = CreateObject("ADSystemInfo")
Set WshShell = CreateObject("WScript.Shell")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
strName = objUser.FirstName & " " & objUser.LastName
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
objSelection.TypeText Chr(14)
Set objWord = CreateObject("Word.Application")
objSelection.TypeText Chr(14)
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
objSelection.TypeText Chr(14)
Set objEmailOptions = objWord.EmailOptions
Set objSignatureObject = objEmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries
objSelection.Font.Bold = True
objSelection.Font.Name = "Veranda"
objSelection.Font.Size = 11
if (strCred) Then objSelection.TypeText strName & ", " & strCred Else objSelection.TypeText strName
objSelection.TypeText Chr(14)
objSelection.Font.Bold = False
objSelection.Font.Name = "Veranda"
objSelection.Font.Size = 11
objSelection.TypeText strTitle
objSelection.TypeText Chr(14)
objSelection.TypeText "BridgeStreet Worldwide"
objSelection.TypeText Chr(14)
objSelection.TypeText "T: " & strPhone
objSelection.TypeText Chr(14)
if (strFax) Then objSelection.TypeText "F: " & strFax & Chr(11)
if (strMobile) Then objSelection.TypeText "C: " & strMobile & Chr(11)
Set hyp = objSelection.Hyperlinks.Add(objSelection.range, "mailto:" & strEmail, , ,strEmail)
hyp.Range.Font.Size = "11"
hyp.Range.Font.Name = "Veranda"
objSelection.TypeText Chr(14)
Set hyp = objSelection.Hyperlinks.Add(objSelection.Range, "" & "hyp.Range.Font.Size = "11"
hyp.Range.Font.Name = "Veranda"
objSelection.TypeText Chr(14)
objSelection.Font.Bold = True
objSelection.Font.Name = "Veranda"
objSelection.Font.Size = 11
objSelection.TypeText "Best Serviced Apartment Company - "
objSelection.Hyperlinks.Add objSelection.Range, " " & " & " ", , , "Business Travel Awards 2010", "_blank"
Set objSelection = objDoc.Range(objSelection.End-28,objSelection.End)
objSelection.Font.Bold = True
objSelection.Font.Name = "Veranda"
objSelection.Font.Size = 11
objSelection.Font.Underline = false
Set objSelection = objDoc.Range()
objSignatureEntries.Add "Full Signature", objSelection
objSignatureObject.NewMessageSignature = "Full Signature"
objSignatureEntries.Add "Reply Signature", objSelection
objSignatureObject.ReplyMessageSignature = "Reply Signature"
objDoc.Saved = True
objWord.Quit
I need code in the the script that will not run if it sees these computernames. It a basic Outlook Signature script like so.
On Error Resume Next
Dim objFSO, copyFile, vSystemDrive
Set WshShell = WScript.CreateObject("Wscript.Shell")
vAPPDATA = WshShell.ExpandEnvironmentStrings("%APPDATA%")
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFolder(vAPPDATA & "\microsoft\signatures\*.*")
objFSO.DeleteFile(vAPPDATA & "\microsoft\signatures\*.*")
Set objSysInfo = CreateObject("ADSystemInfo")
Set WshShell = CreateObject("WScript.Shell")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
strName = objUser.FirstName & " " & objUser.LastName
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
objSelection.TypeText Chr(14)
Set objWord = CreateObject("Word.Application")
objSelection.TypeText Chr(14)
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
objSelection.TypeText Chr(14)
Set objEmailOptions = objWord.EmailOptions
Set objSignatureObject = objEmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries
objSelection.Font.Bold = True
objSelection.Font.Name = "Veranda"
objSelection.Font.Size = 11
if (strCred) Then objSelection.TypeText strName & ", " & strCred Else objSelection.TypeText strName
objSelection.TypeText Chr(14)
objSelection.Font.Bold = False
objSelection.Font.Name = "Veranda"
objSelection.Font.Size = 11
objSelection.TypeText strTitle
objSelection.TypeText Chr(14)
objSelection.TypeText "BridgeStreet Worldwide"
objSelection.TypeText Chr(14)
objSelection.TypeText "T: " & strPhone
objSelection.TypeText Chr(14)
if (strFax) Then objSelection.TypeText "F: " & strFax & Chr(11)
if (strMobile) Then objSelection.TypeText "C: " & strMobile & Chr(11)
Set hyp = objSelection.Hyperlinks.Add(objSelection.range, "mailto:" & strEmail, , ,strEmail)
hyp.Range.Font.Size = "11"
hyp.Range.Font.Name = "Veranda"
objSelection.TypeText Chr(14)
Set hyp = objSelection.Hyperlinks.Add(objSelection.Range, "" & "hyp.Range.Font.Size = "11"
hyp.Range.Font.Name = "Veranda"
objSelection.TypeText Chr(14)
objSelection.Font.Bold = True
objSelection.Font.Name = "Veranda"
objSelection.Font.Size = 11
objSelection.TypeText "Best Serviced Apartment Company - "
objSelection.Hyperlinks.Add objSelection.Range, " " & " & " ", , , "Business Travel Awards 2010", "_blank"
Set objSelection = objDoc.Range(objSelection.End-28,objSelection.End)
objSelection.Font.Bold = True
objSelection.Font.Name = "Veranda"
objSelection.Font.Size = 11
objSelection.Font.Underline = false
Set objSelection = objDoc.Range()
objSignatureEntries.Add "Full Signature", objSelection
objSignatureObject.NewMessageSignature = "Full Signature"
objSignatureEntries.Add "Reply Signature", objSelection
objSignatureObject.ReplyMessageSignature = "Reply Signature"
objDoc.Saved = True
objWord.Quit