'Manage Engine Desktopcentral Agent . 'Script to Configure ManageEngine Desktop Central Agent - Server Communication Settings . '======================================================================================= On Error Resume Next Set WshShell = WScript.CreateObject("WScript.Shell") Set WshSysEnv = WshShell.Environment("Process") checkOSArch = WshShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE") 'Wscript.Echo checkOSArch if Err Then Err.Clear 'WScript.Echo "The OS Architecture is unable to find ,so it was assumed to be 32 bit" regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\AdventNet\DesktopCentral\DCAgent\ServerInfo\" else if checkOSArch = "x86" Then 'Wscript.Echo "The OS Architecture is 32 bit" regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\AdventNet\DesktopCentral\DCAgent\ServerInfo\" else 'Wscript.Echo "The OS Architecture is 64 bit" regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\AdventNet\DesktopCentral\DCAgent\ServerInfo\" End IF End If 'Needs five arguments if WScript.Arguments.Count = 5 Then serverName = WScript.Arguments.Item(0) ' servername ipaddress = WScript.Arguments.Item(1) ' server ip address serverHttpPort = WScript.Arguments.Item(2) ' http port number serverHttpsPort = WScript.Arguments.Item(3) ' https port number serverProtocol = WScript.Arguments.Item(4) ' protocol (http/https) WshShell.Run "%windir%\system32\sc stop " &Chr(34)& "ManageEngine Desktop Central - Remote Control" &Chr(34),1,True WshShell.RegWrite regkey&"DCServerName",serverName WshShell.RegWrite regkey&"DCServerIPAddress",ipaddress WshShell.RegWrite regkey&"DCLastAccessName",ipaddress WshShell.RegWrite regkey&"DCServerPort",serverHttpPort WshShell.RegWrite regkey&"DCServerSecurePort",serverHttpsPort WshShell.RegWrite regkey&"DCServerProtocol",serverProtocol WshShell.Run "%windir%\system32\sc start " &Chr(34)& "ManageEngine Desktop Central - Remote Control" &Chr(34),1,True End if '******************************************************************************************************