Solved

Deploying Scripts

Posted on 2013-07-01
15
383 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: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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
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 this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now