How do I sign a script so Outlook will run it without querying it.


I've got a VBS script (below).

When I run it, Outlook XP says that there is another program running, sending email on my behalf.

What I want to do is :

1 - Get a digitial signature.
2 - Sign the script so that Outlook knows that it is from me.
3 - In the script, check that I will be allowed to send email.
4 - Tell Outlook only to allow signed/trusted scripts.

The script is ...

' AVUpdate.VBS (C) UK 2002 Carval Computing Ltd
' Author Richard Quadling
' Date Friday, 5 April 2002 12:37 12:37:53 PM
' This script is to be launched during the McAfee AntiVirus Update routines as follows.

' Define the necessary variables and objects.
Dim CurrentVersion, SDATFileName, FileSystem, CurrentFile, CurrentStream, INILine, OutlookApp, OutlookMailItem

' Create the FileSystem, Files and TextStreams Objects.
Set FileSystem = CreateObject("Scripting.FileSystemObject")
Set CurrentFile = FileSystem.GetFile("Updates (SDAT program for ALL platforms)\DELTA.INI")
Set CurrentStream = CurrentFile.OpenAsTextStream(1, 0)

' Get the CurrentVersion
With CurrentStream
        INILine = .ReadLine
    Loop While INILine <> "[Contents]"
        INILine = .ReadLine
        If Left(INILine, 15) = "CurrentVersion=" Then
            CurrentVersion = Right(INILine, 4)
        End If
    Loop While Mid(INILine, 1, 1) <> "["
End With

' Build the SDATFilename
SDATFileName = "V:\Updates (SDAT program for ALL platforms)\SDAT" & CurrentVersion & ".EXE"

' Does the SDAT file does exist.
With FileSystem
      if .FileExists(SDATFileName) = False Then
' Preserve the local SuperDAT.LOG file
            .MoveFile "Updates (SDAT program for ALL platforms)\SuperDAT.log", ".\"

' Copy everything to V:\Updates (SDAT program for ALL platforms).
            .CopyFile "Updates (SDAT program for ALL platforms)\*.*", "V:\Updates (SDAT program for ALL platforms)", True

' Restore the local SuperDAT.LOG file
            .MoveFile "SuperDAT.log", "Updates (SDAT program for ALL platforms)\"
      End If

' Check to see if the SDAT file does exist.
      If .FileExists(SDATFileName)  Then

' Copy the current SuperDat.log file as SuperDat CurrentVersion CCYYMMDD.log
            If .FileExists("V:\Updates (SDAT program for ALL platforms)\SuperDat.log") Then
                  .MoveFile "V:\Updates (SDAT program for ALL platforms)\SuperDat.log", "V:\Updates (SDAT program for ALL platforms)\SuperDat" + CurrentVersion + " " + Format(Date, "YYYYMMDD") + ".log"
            End If

' Email everyone about the new file.
      Set OutlookApp = CreateObject("Outlook.Application")
      Set OutlookMailItem = OutlookApp.CreateItem(olMailItem)
        With OutlookMailItem
                  .Subject = "McAfee AntiVirus Update V4.0." + CurrentVersion
                  .To = "Alan Cannon;Chris Sweby;Clive Caunter;Jeff Bowes;Jo Albon;John Cannon;Lisa Collins;Nicola Taylor;Richard Quadling"
                  .HTMLBody = _
                        "<html>" + Chr(13) + _
                        "<body>" + Chr(13) + _
                        "<div align=""center""><h1><b>McAfee AntiVirus Update V4.0." + CurrentVersion + "</b></h1></div><br>" + Chr(13) + _
                        "<div><b>If you are reading this email, then make sure that the little shield in the system tray next to the clock has a sword over the top of it. If not, then your system may not be protecting you against email based viruses!!!!</b></div><br>" + Chr(13) + _
                        "<div>The latest McAfee AntiVirus update can be ran by clicking <a href=""file://\\Carvalnt\AntiVirus\Updates (SDAT program for ALL platforms)\sdat" + CurrentVersion + ".exe"" alt=""McAfee AntiVirus Update Version V4.0." + CurrentVersion + """>here</a>.</div><br>" + Chr(13) + _
                        "<div>When you click the link, you will see a window called ""<tt>Opening Mail Attachment</tt>""<div><br>" + Chr(13) + _
                        "<div>Check that you are opening ...</div><br>" + Chr(13) + _
                        "<div><tt>sdat" + CurrentVersion + ".exe</tt> from <tt>\\Carvalnt\AntiVirus\Updates (SDAT Program for ALL platforms)\</tt><div><br>" + Chr(13) + _
                        "<div>You need to select the ""<tt>Open it</tt>"" option and the click on ""<tt>OK</tt>"".</div><br>" + Chr(13) + _
                        "<div>You must now follow whatever instructions given to you by the updater.</div><br>" + Chr(13) + _
                        "<div>You <b>MUST</b> reboot if you are told to do so.</div><br>" + Chr(13) + _
                        "<div>Our servers are all on automatic updates and are currently running this release.<div><br>" + Chr(13) + _
                        "<div>The Support pc will check to see if an update is necessary every time the pc is turned on. Please be patient with this pc as it only has 24MB of memory and the booting and checking process will take some time.</div><br>" + Chr(13) + _
                        "<br>" + Chr(13) + _
                        "<div>Richard.</div><br>" + Chr(13) + _
            End With
      End If
End With

LVL 40
Richard QuadlingSenior Software DeveloperAsked:
Who is Participating?
Neo_mvpsConnect With a Mentor Commented:
Just so you know that what I am saying about digital certs is true, see  You will find a paragraph that states...

There is no way to circumvent Outlook security features using registry keys, digital certificates, or any other mechanism other than that described in the article above.
Richard QuadlingSenior Software DeveloperAuthor Commented:
This script is saved as a .VBS file and is ran when my local machine has a new virus update (which happens automatically).


Richard Quadling.
Welcome to the enhance email security update -- who some like to call "hell".

here is the bad news... signing the script will not do anything about that prompt.  your options are the following.

1) you connect to a microsoft exchange or hp openmail system. ask the administrator to implement the admintrative features of this enhancement.  good information on it can be found at:

2) redo your solution using c/c++ (or delphi) and extended mapi.

3) use a 3rd party tool called redemption that allows any com based development language to use the outlook object model w/out incuring the security dialogs

oh darn... one more.

4) if your solution is running on windows 2000 or windows xp box, use cdo for windows 2000 to send administrative smtp alerts. (i do this one for symantec's norton antivirus corporate edition)

Richard QuadlingSenior Software DeveloperAuthor Commented:

I don't want to change the security model as this will mean those stupid VBS auto-attachments can run when I don't want them to.

My VBS is actually launched by the our AV updater on a successful update.


Richard Quadling.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.