Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Deploying Scripts

Posted on 2013-07-01
15
Medium Priority
?
425 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
  • 8
  • 5
  • 2
15 Comments
 
LVL 42

Expert Comment

by:Meir Rivkin
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:Meir Rivkin
ID: 39290010
the guisap is installed but the registry hive is not??
0
Industry Leaders: 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:
Meir Rivkin earned 1000 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:Meir Rivkin
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:Meir Rivkin
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 1000 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

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!

Question has a verified solution.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
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…
Suggested Courses

886 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