OverviewExamples
Service.Continue ( |
Service.Continue("Service1", "");
Continues the service "Service1".
-- Specify the antivirus service display name
VirusScannerServiceName = "AntiVirus";
-- Pause the virus scanner
Service.Pause(VirusScannerServiceName, "");
-- Run the setup which cannot be run while a virus scanner is active
File.Run(SessionVar.Expand("%SourceFolder%\\setup2.exe"), "", "", SW_SHOWNORMAL, true);
-- Resume the virus scanner
Service.Continue(VirusScannerServiceName, "");
Pauses the specified virus scanner service before launching a separate setup file.
-- Specify the service to query
ServiceToQueryDisplay = "Service1";
ServiceToQueryKey = "Boom";
-- Query the specified service
QueryResult = Service.Query(ServiceToQueryDisplay, ServiceToQueryKey);
if not (QueryResult == SERVICE_RUNNING) then
-- Set err to 0
err = 0;
-- The service is not running.
if (QueryResult == SERVICE_PAUSED) then
-- The service is paused, try continue
Service.Continue(ServiceToQueryDisplay, ServiceToQueryKey);
err = Application.GetLastError();
elseif (QueryResult == SERVICE_STOPPED) then
-- The service is stopped, try start
Service.Start(ServiceToQueryDisplay, ServiceToQueryKey, nil);
err = Application.GetLastError();
end
if not (err == 0) then
-- An error happened with Continue/Start
Dialog.Message("Error (" .. err .. ")", "Unable to start/restart the service.\r\nService is not running");
else
Dialog.Message("PERFECTION!", "The service was started/restarted fine.");
end
else
-- The service is running
Dialog.Message("PERFECTION!", "The service is running fine.");
end
Queries the specified service. If it is running, a dialog is displayed. If it is not running, it is restarted and either a successful or error dialog is displayed.
See also: Related Actions