Solved

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

Posted on 2002-04-05
5
261 Views
Last Modified: 2008-03-17
Hi.

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
    Do
        INILine = .ReadLine
    Loop While INILine <> "[Contents]"
    Do
        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) + _
                        "</body></html>"
                  .Send
            End With
      End If
End With

0
Comment
Question by:RQuadling
  • 3
  • 2
5 Comments
 
LVL 40

Author Comment

by:RQuadling
Comment Utility
This script is saved as a .VBS file and is ran when my local machine has a new virus update (which happens automatically).

Regards,

Richard Quadling.
0
 
LVL 16

Expert Comment

by:Neo_mvps
Comment Utility
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:

http://www.slipstick.com/outlook/esecup.htm
http://www.slipstick.com/outlook/esecup/admin.htm

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

http://www.dimastr.com

0
 
LVL 16

Expert Comment

by:Neo_mvps
Comment Utility
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)

0
 
LVL 16

Accepted Solution

by:
Neo_mvps earned 300 total points
Comment Utility
Just so you know that what I am saying about digital certs is true, see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dn_voices_askgui/html/askgui04022002.asp.  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.
0
 
LVL 40

Author Comment

by:RQuadling
Comment Utility
Hi.

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.

Thanks.

Richard Quadling.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

My experience with Windows 10 over a one year period and suggestions for smooth operation
Sometimes Outlook might have problems sending a message. There may be various causes- corrupted PST, AV scanner etc. The message, instead of going to the Sent Items folder, sits in the Outbox indefinitely. To remove it you can use a free tool cal…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now