Set/Get service status.
long ServiceStatus( [in] BSTR Name, [in] long Action )
Parameters
Name
Service name, it can be smtpd, pop3d, webmail, rocd or log.
Action
If this value is zero, this method only get the service status. If this value is 1, this method starts specified service. If this value is 2, this method stops specified service.
Return Value
If specified service is stopped, return value is zero; otherwise return value is 1.
Remarks
Webmail service can't be stopped by this method.
Usage Example
Dim server, user, password, requestAddr server = "localhost" user = "system" password = "mypassword" requestAddr = "192.168.0.1" Dim oSvr Set oSvr = CreateObject("EmailArchitectObjects.ServerRoot") r = oSvr.Connect( server, user, password, 0, requestAddr ) If r <> 0 Then WScript.Echo( "connect server failed!" ) End If Dim oServices Set oServices = oSvr.ServiceCollection Dim arServices arServices = Array( "smtpd", "pop3d", "webmail", "rocd", "log" ) Dim i, nCount nCount = UBound(arServices) For i = LBound(arServices) To nCount If oServices.ServiceStatus( arServices(i), 0 ) = 1 Then WScript.Echo( arServices(i) & " is running..." ) Else WScript.Echo( arServices(i) & " service stopped" ) oServices.ServiceStatus arServices(i), 1 'start all stopped services End If Next
See Also
ServiceSessions
GetConnectionInfo
TerminateConnection
EmailArchitect Email Server SDK Document Index
Copyright © 2006 - 2025 AIFEI & AdminSystem Software Limited. All rights reserved.