Link to home
Start Free TrialLog in
Avatar of Fady AbuZuaiter
Fady AbuZuaiterFlag for Qatar

asked on

Deploying Scripts

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
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

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

Avatar of Fady AbuZuaiter

ASKER

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,
the guisap is installed but the registry hive is not??
yes
ASKER CERTIFIED SOLUTION
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
when u uninstall the registry should be removed.
are you sure it stays?
does sapgui is installed on c:\program files?
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 .
what is the location of the exe?
This is the location of the exe

"C:\Program Files (x86)\SAP\FrontEnd\SAPgui\saplogon.exe"
is there a possible soluation to check this as per the exe file ?
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.
what kind of information you need ?
it will be good if i can do it by batch file instead of Power Shell.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial