Solved

Deploying Scripts

Posted on 2013-07-01
15
386 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
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.
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…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

932 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

10 Experts available now in Live!

Get 1:1 Help Now