Solved

Deploying Scripts

Posted on 2013-07-01
15
391 Views
Last Modified: 2013-07-01
Hello,

We are using a script to Deploy SAP GUI Application. but i need to modify the script to check if the application already installed or no ?

this is the script which i used it and deploying in by GPO.

@echo off

\\SERVER_NAME\50118243_6\NW_7.0_Presentation_\PRES1\GUI\WINDOWS\WIN32\Setup\NwSapSetup.exe /Silent /Product="SAPGUI710"


@echo off

Open in new window


Regards
0
Comment
Question by:fadyaz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
  • 2
15 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 39289951
HKEY_LOCAL_MACHINE\SOFTWARE\SAP is the hive in registry where SAPGUI writes many settings which are "machine wide",
so u can first check if the hive exists and if not continue with the installation.
@echo off
reg query HKEY_LOCAL_MACHINE\SOFTWARE\SAP && echo "Sap Gui already installed" || \\SERVER_NAME\50118243_6\NW_7.0_Presentation_\PRES1\GUI\WINDOWS\WIN32\Setup\NwSapSetup.exe /Silent /Product="SAPGUI710"

@echo off

Open in new window

0
 
LVL 2

Author Comment

by:fadyaz
ID: 39289995
Thanks sedgwick for your reply i tried the script but it didnt work it reinstalled the SAP. the registry key already not there but the SAP is there and working .

Regards,
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 39290010
the guisap is installed but the registry hive is not??
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:fadyaz
ID: 39290070
yes
0
 
LVL 42

Accepted Solution

by:
sedgwick earned 250 total points
ID: 39290087
try this:
@echo off
reg query HKEY_CURRENT_USER\SOFTWARE\SAP && echo "Sap Gui already installed" || \\SERVER_NAME\50118243_6\NW_7.0_Presentation_\PRES1\GUI\WINDOWS\WIN32\Setup\NwSapSetup.exe /Silent /Product="SAPGUI710"

@echo off

Open in new window

0
 
LVL 2

Author Comment

by:fadyaz
ID: 39290146
Thanks this is work but the problem if i uninstalled the application and i will installed again by using this script it will not installed because the registry still exist and didn't removed with the deletion. is there any way to check it by check the exe app in the programs file ?


regards
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 39290162
when u uninstall the registry should be removed.
are you sure it stays?
does sapgui is installed on c:\program files?
0
 
LVL 2

Author Comment

by:fadyaz
ID: 39290197
yes the sap GUI installed under this location C:\Program Files (x86)\SAP\

and when i removed it the folder stayed but empty and the registry file stayed there.

i want the script to check the running exe application if it is exist or no .
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 39290203
what is the location of the exe?
0
 
LVL 2

Author Comment

by:fadyaz
ID: 39290257
This is the location of the exe

"C:\Program Files (x86)\SAP\FrontEnd\SAPgui\saplogon.exe"
0
 
LVL 2

Author Comment

by:fadyaz
ID: 39290361
is there a possible soluation to check this as per the exe file ?
0
 
LVL 7

Expert Comment

by:BT15
ID: 39290383
you could do that in powershell:

the following will test for the executable's existence. if it is not there, it will run the installer:

$command = "\\SERVER_NAME\50118243_6\NW_7.0_Presentation_\PRES1\GUI\WINDOWS\WIN32\Setup\NwSapSetup.exe /Silent /Product="SAPGUI710"

if (!(test-path "C:\Program Files (x86)\SAP\FrontEnd\SAPgui\saplogon.exe")){
& $command
}

Open in new window



if given a little more information, I could give you something that would check installed programs instead.
0
 
LVL 2

Author Comment

by:fadyaz
ID: 39290400
what kind of information you need ?
0
 
LVL 2

Author Comment

by:fadyaz
ID: 39290435
it will be good if i can do it by batch file instead of Power Shell.
0
 
LVL 7

Assisted Solution

by:BT15
BT15 earned 250 total points
ID: 39290491
well in batch you could do something like this(borrowed from here http://stackoverflow.com/questions/4340350/how-to-check-if-a-file-exists-from-inside-a-batch-file)

@echo off
if not exist {"C:\Program Files (x86)\SAP\FrontEnd\SAPgui\saplogon.exe"} {\\SERVER_NAME\50118243_6\NW_7.0_Presentation_\PRES1\GUI\WINDOWS\WIN32\Setup\NwSapSetup.exe /Silent /Product="SAPGUI710"}

@echo off

Open in new window


if you dont want powershell, i wont ask you for the additional info i was wanting earlier.
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
AutoHotkey is an excellent, free, open source programming/scripting language for Windows. It started out as a keyboard/mouse macros product, but has expanded into a robust language. This article provides an introduction to it, with links to addition…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

749 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