Deployment Solution

 View Only
  • 1.  help with DC vbs script

    Posted May 19, 2009 07:05 PM


    I am trying to create and run the following two simple vbs script from Deployment console, option "Run this script" and I am getting error 255, the first one to delete a file and the second one to run an installation. I tested in local machine and these work fine, but they do not work in DC, I am new in vbs script, so I guess something I skipped or I have to change, I am not sure how to fix the script, I will appreciate if anyone could look at this and tell me what I suppose to change in the script to run it from DC..Thanks

    delete file:

    vbscript
    dim filesys
    Set filesys = CreateObject("Scripting.FileSystemObject")
    If filesys.FileExists("C:\Program Files\player\player.txt") Then
    filesys.DeleteFile "C:\Program Files\player\player.txt"
    End If



    to run or install application:

    vbscript
    dim filesys
    Set filesys = CreateObject("Scripting.FileSystemObject")
    If filesys.FileExists("C:\Program Files\Mozilla Firefox\Firefox.exe") Then
    Run "C:\download\flashplayer.exe"
    End If


    Thanks for your help in advance....
     



  • 2.  RE: help with DC vbs script

    Posted May 21, 2009 08:53 PM
    Try adding this to the top of your script:

    'insert a description
    'vbscript

    This tells DS its a vbscript and not a dos command.

    Josh


  • 3.  RE: help with DC vbs script

    Posted May 22, 2009 02:50 AM
    Thanks JoshBauser,

    It works fine now, thank for your comment...


  • 4.  RE: help with DC vbs script

    Posted May 22, 2009 03:35 AM
    No problem pragmmativco, anytime.

    Please mark my comment as the solution by click Mark as Solution next to Reply at the bottom right of the comment box, so others know the answer to this problem in the future.

    Josh


  • 5.  RE: help with DC vbs script

    Posted May 24, 2009 08:05 PM

    me again.... I am wondering how can I get a success or failed code when I Run a script that will check if a file exist. before installing application..
     
    What I mean is: I created a new job in Deployment Console, to Run a vbs script that check if Office 2007 is installed, the job run ifne,  if Office 2007 already exist, setup.exe will not run, The issue is that regardless of Office is installed or not the job still return a success code.

    What I need is a job that should display a return code of fail meaning that the vbs script did not run setup.exe because office already existed, ...but at this time in deployment Console all computers show up a success code, regardless if the vbs ran or not...

    May be it can be done in a different way, i will appreciate any comment

    Thanks

     



  • 6.  RE: help with DC vbs script

    Posted May 24, 2009 09:19 PM
    What is your overall mission for this? Are you trying to find if office 2007 is installed and if it isn't install it? Or trying to label computers that don't have it installed by vbs?

    If it's the first one you should do the whole lot in vbs and then the job should always be a success UNLESS an unknown error occured.

    So should be something like (didnt check this for errors just typed it in): 

    dim filesys
    dim WSHShell
    Set filesys = CreateObject("Scripting.FileSystemObject")
    Set WSHShell = WScript.CreateObject("WScript.Shell")
    If not filesys.FolderExists("C:\Program Files\Microsoft Office\Office12\") Then
    WSHShell.Run "C:\Office Install.msi"
    WSHShell.quit(0)
    else
    WSHShell.quit(1)
    End If

    Now this will check whether office 2007 is installed and if not install will install it and return and error level of 0. This will give you a green tick in DS. If it is installed it will give you an error level of 1 which in DS will give you the red cross. Or you can change the errorlevel codes in DS to what you want. This is done by double clicking on the job and going to the last page of the job setup. Add your errorlevel and your return text and whether it complete or failed or should go to next job.

    Josh


  • 7.  RE: help with DC vbs script

    Posted May 25, 2009 12:36 AM
    Thanks JoshBauer,

    You pointed me to the right direction, I tested the script using WSHShell.quit(0) and WSHShell.quit(1), that will allow to go to next job if the return code is success. I am new with scripting so I appreciate your help

    Thanks


  • 8.  RE: help with DC vbs script

    Posted May 25, 2009 07:59 PM
    No problem Pragmmativco,

    It was a pleasure helping you out, and i'm glad it all worked out for you.

    Josh Bauer