+ 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,497
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    76

    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,638
    Thank Post
    640
    Thanked 2,155 Times in 1,474 Posts
    Blog Entries
    19
    Rep Power
    894
    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 02:57 PM.

  3. #3
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,497
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    76
    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,761
    Thank Post
    354
    Thanked 532 Times in 497 Posts
    Rep Power
    182
    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,638
    Thank Post
    640
    Thanked 2,155 Times in 1,474 Posts
    Blog Entries
    19
    Rep Power
    894
    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.403651, -0.515458
    Posts
    9,613
    Thank Post
    250
    Thanked 2,900 Times in 2,133 Posts
    Rep Power
    828
    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 03:13 PM.

  7. #7
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,497
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    76
    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
    736
    Thank Post
    118
    Thanked 67 Times in 55 Posts
    Rep Power
    32
    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,497
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    76
    Thanks @Chuckster, that is a .bat file, right?

  10. #10

    Join Date
    Jun 2008
    Posts
    736
    Thank Post
    118
    Thanked 67 Times in 55 Posts
    Rep Power
    32
    Yup, that's right @enjay

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

  12. #12

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,977
    Thank Post
    3,527
    Thanked 1,107 Times in 1,014 Posts
    Rep Power
    374
    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

    Garacesh's Avatar
    Join Date
    Jan 2012
    Posts
    3,223
    Thank Post
    1,206
    Thanked 476 Times in 347 Posts
    Rep Power
    235
    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 01:40 PM.

  14. #14
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,497
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    76
    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

    Garacesh's Avatar
    Join Date
    Jan 2012
    Posts
    3,223
    Thank Post
    1,206
    Thanked 476 Times in 347 Posts
    Rep Power
    235
    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 02:05 PM.

  16. Thanks to Garacesh from:

    enjay (23rd October 2013)



SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 17
    Last Post: 20th March 2010, 12:51 AM
  2. A script to check for UAC
    By Oops_my_bad in forum Scripts
    Replies: 0
    Last Post: 29th April 2009, 12:31 PM
  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, 09:15 PM
  4. Replies: 4
    Last Post: 23rd March 2006, 07:27 AM
  5. Replies: 3
    Last Post: 1st March 2006, 01: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
  •