'To install agent with the share path given as argument '=================================================================== on error resume next Set WSHShell = WScript.CreateObject("WScript.Shell") ' Get Location and arguments of the script Set oFS = CreateObject("Scripting.FileSystemObject") windowsdir = WSHShell.ExpandEnvironmentStrings("%windir%") Set WriteStuff = oFS.OpenTextFile(windowsdir+"/EventLogScriptlog.txt", 8, True) Log(" =========== Script Execution Start : =====================") Set args = WScript.Arguments.Named Agent_Install_Log_path = windowsdir+ "//Agent_Install.log" msiPath = args.Item("MSIPATH") zapikey = args.Item("ZAPIKEY") serverName = "log360cloud.manageengine.com" portNumber = "443" ipaddress = "log360cloud.manageengine.com" protocol = "https" IF (msiPath <> "" and zapikey <> "")THEN argument = "msiexec.exe /i """ & msiPath & """" argument = argument & " /qn /norestart /L*v " argument = argument & Agent_Install_Log_path argument = argument & " SERVERNAME=" & trim(serverName) argument = argument & " SERVERIPADDRESS=" & trim(ipaddress) argument = argument & " SERVERPORT=" & trim(portNumber) argument = argument & " SERVERPROTOCOL=" & trim(protocol) argument = argument & " ZAPIKEY=" & trim(zapikey) argument = argument & " ENABLESILENT=yes ALLUSERS=1" Log(" Constructed Argument : " + argument) If oFS.FileExists(msiPath) = True Then Log("Log360CloudAgent.msi is accessible from specified location") verKey = "HKEY_LOCAL_MACHINE\SOFTWARE\ZOHO Corp\Log360Cloud\LogAgent\AgentVersion" serverKey = "HKEY_LOCAL_MACHINE\SOFTWARE\ZOHO Corp\Log360Cloud\ServerInfo\ServerName" IF ( is64BitProcessor() = true) THEN Log("64 BIT PROCESSOR") verKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ZOHO Corp\Log360Cloud\LogAgent\AgentVersion" serverKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ZOHO Corp\Log360Cloud\ServerInfo\ServerName" End if strVersion = WSHShell.RegRead(verKey) strServerName = WSHShell.RegRead(serverKey) IF ( strVersion <> "") Then Log("Agent Already Installed from server " & strServerName & " of Agent version" & strVersion) ELSE installStatus = WSHShell.run(argument,1,true) Log("Install : Status Code : " & installStatus) END IF Else Log("Log360CloudAgent.msi could not be opened. Verify that the package exists and is accessible on location " & msiPath ) End if ELSE Log("Invalid GPO Argument ") Log(" MSIPATH :" & msiPath & " SERVERNAME : " & serverName & " PORTNUMBER : " & portNumber & " SERVER IP :" & ipaddress & " PROTOCOL (http\https) : " & protocol) END IF Log(" =========== Script Execution end : =====================") Function is64BitProcessor() on error resume next Set WShell = WScript.CreateObject("WScript.Shell") proName = WShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE") Log("The Operating System Processor is : " & proName) v32 = Mid(proName,Instr(1,proName,"86"),2) v64 = Mid(proName,Instr(1,proName,"64"),2) IF( v32 = "86") Then is64BitProcessor = false ELSEif( v64 = "64") THEN is64BitProcessor = true END IF Set WShell = Nothing End Function Function Log(logStr) WriteStuff.WriteLine ( now & " :: " & logStr) End Function WriteStuff.close