On Error Resume Next Set WSHShell = WScript.CreateObject("WScript.Shell") 'Get the arguments of the script if(Wscript.Arguments.count>=1)then msiFile = WSCript.Arguments.Item(0) msiArg = "" For i = 1 To Wscript.Arguments.count-1 msiArg = msiArg & " " & Wscript.Arguments.Item(i) Next else Wscript.Echo "File name is not provided" Wscript.quit(0) end if const HKEY_LOCAL_MACHINE = &H80000002 Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv") is64BitOS = false objReg.GetStringValue HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "PROCESSOR_ARCHITECTURE", osArch if not isNULL(osArch) then pos=InStr(osArch,"64") if pos>0 Then is64BitOS = true End if End if if is64BitOS then objReg.GetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\Wow6432Node\Freshdesk\FSAgent\", "Version", version else objReg.GetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\Freshdesk\FSAgent\", "Version", version end if if(isNull(version) or version="")Then dateval = Date timeval = Time dateval = Replace(dateval,"/",".") timeval = Replace(timeval,":",".") Set WSHShell = WScript.CreateObject("WScript.Shell") wshshell.Run "msiexec.exe /i """&msiFile&""""&msiArg&" ENABLESILENT=yes REBOOT=ReallySuppress /qn /Log "& Chr(34)& "%TEMP%\fsagentInstallerLog."&dateval&"-"&timeval&".txt"& Chr(34) ,0,True end if