+ Post New Thread
Results 1 to 15 of 15
Windows Server 2000/2003 Thread, Script to Check for Install in Technical; I need to deploy some software (to an RM CC3 network) which has a setup.exe and some command lines, so ...
  1. #1
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,485
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    75

    Script to Check for Install

    I need to deploy some software (to an RM CC3 network) which has a setup.exe and some command lines, so I can't package it. I can deploy it via a batch file in the startup scripts GPO (sshh, don't tell RM!), but that installs it every time it boots. Is there a way that I can run a script which first checks whether the application exists? I'm sure it is possible, but I've spent too long on an RM network to know how!

  2. #2

    X-13's Avatar
    Join Date
    Jan 2011
    Location
    /dev/null
    Posts
    9,030
    Thank Post
    591
    Thanked 1,943 Times in 1,344 Posts
    Blog Entries
    19
    Rep Power
    813
    Quote Originally Posted by enjay View Post
    I need to deploy some software (to an RM CC3 network) which has a setup.exe and some command lines, so I can't package it. I can deploy it via a batch file in the startup scripts GPO (sshh, don't tell RM!), but that installs it every time it boots. Is there a way that I can run a script which first checks whether the application exists? I'm sure it is possible, but I've spent too long on an RM network to know how!
    Why not just install it via GPO and use a transform file?

    For referance: http://www.itninja.com/blog/view/deploying-mst-files-using-group-policy​
    Last edited by X-13; 22nd October 2013 at 01:57 PM.

  3. #3
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,485
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    75
    Quote Originally Posted by X-13 View Post
    Why not just install it via GPO and use a transform file?
    Because it is a .exe, not an MSI.

  4. #4

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,689
    Thank Post
    334
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Assuming it's a normal VBS startup script?

    Then just run a check on the installed exe location, and do an if not then install etc

    Example, not tested

    Code:
    Set fso = CreateObject("Scripting.FileSystemObject")
    If (fso.FileExists("MyExe.Com")) Then
      
    Else
       "InstallCrap"
    End If
    Steve

  5. #5

    X-13's Avatar
    Join Date
    Jan 2011
    Location
    /dev/null
    Posts
    9,030
    Thank Post
    591
    Thanked 1,943 Times in 1,344 Posts
    Blog Entries
    19
    Rep Power
    813
    Quote Originally Posted by enjay View Post
    Because it is a .exe, not an MSI.


    Even though I read that... it didn't register. Sorry.

  6. #6


    Join Date
    Feb 2007
    Location
    51.405546, -0.510212
    Posts
    8,749
    Thank Post
    221
    Thanked 2,626 Times in 1,936 Posts
    Rep Power
    778
    Quote Originally Posted by enjay View Post
    I need to deploy some software (to an RM CC3 network) which has a setup.exe and some command lines, so I can't package it.
    You just need to create a suitable package.ini file to deploy the EXE.

    Code:
    [Package]
    Description=Example Application
    Version=1.0.0.0
    OS=5.WS,6.WS
    ExeFile=NameOfYourInstaller.exe
    Addcommand= /passive /quiet /norestart
    UninstallCommand= /passive /quiet /norestart
    See TEC21757 (RM KB article) for more details.
    Last edited by Arthur; 22nd October 2013 at 02:13 PM.

  7. #7
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,485
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    75
    Quote Originally Posted by Arthur View Post
    You just need to create a suitable package.ini file to deploy the EXE.
    Forgot that was possible. I think the script might be the way to go, though, as there is another file it needs which has to be in the same location as the setup.exe, and I don't know what AppAgent would make of that.

  8. #8

    Join Date
    Jun 2008
    Posts
    718
    Thank Post
    119
    Thanked 64 Times in 52 Posts
    Rep Power
    31
    What you want is something like this..

    Code:
     @echo off
    
    REM * Installing EloTouch Drivers 5.5.0 32-bit *
    if exist "C:\Program Files\Elo TouchSystems" goto lastbit
    
    :Install_EloTouch
    \\schoolname.internal\Applications$\Drivers\SW602132_EloTouchMouse_5.5.0\32Bit\EloSetup.exe [/Reboot] [/NoHandshake] [/S] [/Iu] [/Is] [/P:1,2,3,4]
    
    :lastbit
    exit

  9. #9
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,485
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    75
    Thanks @Chuckster, that is a .bat file, right?

  10. #10

    Join Date
    Jun 2008
    Posts
    718
    Thank Post
    119
    Thanked 64 Times in 52 Posts
    Rep Power
    31
    Yup, that's right @enjay

  11. #11
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,485
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    75
    Perfect, thanks.

  12. #12

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,705
    Thank Post
    3,236
    Thanked 1,045 Times in 967 Posts
    Rep Power
    363
    Failing that isn't there a registry key where it logs all the installed applications and just enumerate through that registry key to see if it shows as an installed application ?

  13. #13


    Join Date
    Jan 2012
    Posts
    2,569
    Thank Post
    921
    Thanked 342 Times in 263 Posts
    Rep Power
    206
    Quote Originally Posted by Chuckster View Post
    What you want is something like this..
    -- Code --
    Using GoTo's @Chuckster? Shame on you! I believe there's a velociraptor heading your way (Somebody be a darling and post the link? XKCD's blocked here)
    Although if you insist on it, I might point out :lastbit wasn't required.. Batch will interpret "goto :eof" (end-of-file) as an immediate quit, iirc

    Code:
    @echo off
    REM * Installing EloTouch Drivers 5.5.0 32-bit *
    if not exist "C:\Program Files\Elo TouchSystems" (
    
    \\schoolname.internal\Applications$\Drivers\SW602132_EloTouchMouse_5.5.0\32Bit\EloSetup.exe [/Reboot] [/NoHandshake] [/S] [/Iu] [/Is] [/P:1,2,3,4]
    )
    Last edited by Garacesh; 23rd October 2013 at 12:40 PM.

  14. #14
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,485
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    75
    So, a velociraptor-free command would be:

    if not exist "C:\Program Files\PaperCut NG\licence.txt"
    "\\server1\software installers\papercut\pcng-setup-13.3.23186.exe" /TYPE=secondary_print /VERYSILENT /NOICONS

    Yes?

  15. #15


    Join Date
    Jan 2012
    Posts
    2,569
    Thank Post
    921
    Thanked 342 Times in 263 Posts
    Rep Power
    206
    With brackets, yes.
    Code:
    if not exist "C:\Program Files\PaperCut NG\licence.txt" ("\\server1\software installers\papercut\pcng-setup-13.3.23186.exe" /TYPE=secondary_print /VERYSILENT /NOICONS)
    Personally I like to 'branch' my code across multiple lines and with indents, just for easier readability, so I'd personally have it as:
    Code:
    if not exist "C:\Program Files\PaperCut NG\licence.txt" (
    
    "\\server1\software installers\papercut\pcng-setup-13.3.23186.exe" /TYPE=secondary_print /VERYSILENT /NOICONS
    )
    But the command line interprets it the same, either way.

    Currently, the code character-for-character, as-posted, is two separate commands, one of which being an IF with a condition but no action, the other being the install.
    It would check for licence.txt, and if it found it, progress to the next command (install PaperCut). If it didn't find it, it would proceed to the next command. The brackets make it all one command, and it will only process the if the IF statement is true (in this case, if the license.txt file doesn't exist).. Else's also work (but not ELIF, but you can nest IF commands to the same effect)..

    Code:
    if not exist "C:\Program Files\PaperCut NG\licence.txt" (
    
    "\\server1\software installers\papercut\pcng-setup-13.3.23186.exe" /TYPE=secondary_print /VERYSILENT /NOICONS
    ) ELSE (
    Echo "Yup, it's there!"
    )
    Last edited by Garacesh; 23rd October 2013 at 01:05 PM.

  16. Thanks to Garacesh from:

    enjay (23rd October 2013)

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 17
    Last Post: 19th March 2010, 11:51 PM
  2. A script to check for UAC
    By Oops_my_bad in forum Scripts
    Replies: 0
    Last Post: 29th April 2009, 11:31 AM
  3. VB Script ti check for folder and then copy contents to PC
    By tosca925 in forum How do you do....it?
    Replies: 4
    Last Post: 2nd October 2006, 08:15 PM
  4. Replies: 4
    Last Post: 23rd March 2006, 06:27 AM
  5. Replies: 3
    Last Post: 1st March 2006, 12:08 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •