Hi,
Your demand is not clear about using windows service when running MEGA API. But, if I well understood the purpose of your question is how to create a API that will be launched automatically on a given a server without the intervention of an Admin.
If it's the case, you can code a script that will perform serial of actions to be led on the repository, dispatch the transaction and kill the MEGA process. Of course, you can configure this script with the task scheduler.
Here is an example of a script that connect to a given repository, create an application with the name "APP1", dispatch the transaction and kill the MEGA process.
Mohamed
Set oMegaRoot = Nothing
StrBDD = "Database"
strUser = "U1"
strpass = "PassWord"
Set MegaSite = CreateObject("mega.application")
strPathEnv = "C:\Users\Public\Documents\MEGA HOPEX V1R1\Env"
Set MegaEnv = MegaSite.Environments.Item(strPathEnv)
MegaEnv.CurrentAdministrator = strUser
MegaEnv.CurrentPassword = strpass
MegaEnv.CurrentProfile=strProf
set myTransaction = MegaEnv.Transactions.create(StrBDD, strUser)
set oMegaRoot = myTransaction.Database.Open
MyDB = oMegaRoot.getCollection("Application").create("APP1")
oMegaRoot.MegaCommit
set oMegaRoot = nothing
myTransaction.Dispatch
Set MegaBase = Nothing
Set Root = Nothing
Set MegaSite = Nothing
Dim oWMIService, colProcessList, oProcess, MegaProcess, bGoodEnd
bGoodEnd = true
MegaProcess = "mgwmapp.exe"
Set oWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2")
Set colProcessList = oWMIService.ExecQuery ("Select * from Win32_Process")
For Each oProcess in colProcessList
if oProcess.Name = MegaProcess Then
oProcess.Terminate()
Wscript.Sleep 1000 '1 sec d'attente
end if
Next
Set colProcessList = Nothing
Set oWMIService = Nothing
... View more