Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Install script. I want it to run only if 3 conditions are correct.

Avatar of bsharath
bsharathFlag for India asked on
Programming Languages-OtherScripting LanguagesVB Script
10 Comments1 Solution470 ViewsLast Modified:

Install script. I want it to run only if 3 conditions are correct.
At present as it checks for a file if not available it installs. I want 2 more files or folders to be checked. If not there only then install

C:\Program files\Sophos
C:\Program files\123
Only if the abive 2 and the one file check in the below code is not there then install. Else do nothing

Can anyone help with this


Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set objNetwork = CreateObject("WScript.Network")
Const intForAppending = 8

'Log path
strLogFile = "\\indsm\Logs\AVInstallation.log"
'If we are using as a startup script then change the "Alsvc.e1xe" to "Alsvc.exe"
'it checks for the path if not available reinstall's the Sophos or install if not already there

If objFSO.FileExists ("C:\Program Files\Sophos\AutoUpdate\ALsv1c.exe") then
	strResults =  Now & " - " & objNetwork.ComputerName & ": Already installed."
	strComputer = "."
	Set objWMIService = GetObject("winmgmts:" _
	    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 
	Set colSystemInfo = objWMIService.ExecQuery _
	    ("Select Caption from Win32_OperatingSystem",,48)
	For Each objItem In colSystemInfo
		strOS_Caption = objItem.Caption
	If InStr(strOS_Caption, "Windows NT") = 0 Then
'Need to change the Sid path as per version. Silently uninstall the old ver and do not restart
		objShell.Run ("MsiExec.exe /X {034759DA-E21A-4795-BFB3-C66D17FAD183} /QN /NORESTART"), 1, True
'Install from the below path
'Username and password mentioned
	objShell.Run("\\IND\SophosUpdate\CIDs\S000\SAVSCFXP\Setup.exe -s " & _
			"-updp ""\\IND\SophosUpdate\CIDs\S000\SAVSCFXP"" " & _
			"-user ""emr2"" " & _
			"-pwd ""ab23"" " & _
			"-mng yes"),1,True
		strResults = Now & " - " & objNetwork.ComputerName & ": Installed version for all other OS's"
		objShell.Run("\\IND\SophosUpdate\CIDs\S000\ESNT\Setup.exe -s"), 1, True
		strResults = Now & " - " & objNetwork.ComputerName & ": Installed Windows NT version"
	End If
End If
Set objLogFile = objFSO.OpenTextFile(strLogFile, intForAppending, True)
objLogFile.WriteLine strResults
Avatar of kemot1000
kemot1000Flag of Poland image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 10 Comments.
See Answers