4 Replies Latest reply on Feb 25, 2009 4:10 PM by jdoe

    Pushing a VBScript


      So, this is kind of an odd one.  I've done some googling, some thinking, and some testing and just kind of hitting dead end after dead end.


      I'm trying to update my company's signatures on everyone's outlook, using some fancy vbscript that our scripting guy wrote.

      Well it needs to be run while Outlook isn't running, otherwise it bombs, since it can't update the files associated and other shenanigans.

      So I'm setting the file up in a batch file, and trying to figure out a way to give errorlevel's for a vbscript.  I spelunked through the understanding batch files tutorial and dug into that a little and ended up with this:


      Set ResultCode =%ERRORLEVEL%
      IF "%ResultCode%"=="0" ( sdclient.exe /msg="Signature Updated Successfully"
      ) ELSE ( sdclient.exe /msg="Signature Failed Update with code %ResultCode%.  Exiting" )
      EXIT /B %ResultCode%



      The problem that I'm having is that no matter if it is actually successful in updating the signature, or not, it is returning as a failure to the Core.  I feel like I'm missing something rather obvious, but can't seem to figure out what it is.

      Anybody happen to have any experience in this?  Or any suggestions?


      Thanks for any help.

        • 1. Re: Pushing a VBScript
          jdoe Apprentice

          Are you controlling the return code in the script?  How does the script finish, WScript.Quit(0), etc...

          • 2. Re: Pushing a VBScript

            I have never pushed any signature changes in Outlook but here are some ideas.


            Note: how the signature has to be changed find out if it has to be within the user(s) profile


            You may have to deploy under the user account vs trying to deploy it under the system account.


            Also, If it is a user account or user reg hive change make sure their rights are able to make those kinds of changes.

            (example: You can't  push a reg change as the user if GP prevents the user from using regedit)


            Making sure Outlook isn't open:

            This may be annoying to your end users, but it will kill Outlook.


            Dim objProcesses, objProcess

            Set objProcesses = GetObject("WinMgmts:root/CIMV2").ExecQuery( _
              "SELECT * FROM Win32_Process WHERE Name='OUTLOOK.exe'")

            For Each objProcess In objProcesses


            I found this on experts exchange, but have no proof it works for signatures.



            Dim objShell, RegKey, Q


            Set objShell = CreateObject("WScript.Shell")


                        strQuote = chr(34)    


            RegKey = "<Key>"


            RegKey = RegKey & "\NewSignature"


            objShell.RegWrite RegKey, "<Signature Name>"


            objShell.Run "outlook /profile " & strQuote & "<Profile Name>" & strQuote

            • 3. Re: Pushing a VBScript

              So I just got this to work with a little help from jdoe here.


              I went to my scripting guy and was like, "dude, did you put in these return codes?" and he was all, "no man, I didn't think you wanted those."


              So needless to say, we put some of those in, and then I modified the batch to this...


              Set ResultCode =%ERRORLEVEL%
              EXIT /B %ResultCode%


              And it would fail if outlook was open, and would succeed if it wasn't.


              Thank you very much jdoe.

              • 4. Re: Pushing a VBScript
                jdoe Apprentice

                Glad to hear that helped!