Return to Snippet

Revision: 10277
at December 15, 2008 15:36 by vsai


Initial Code
fn checkService ServiceName server =
(
    dotnet.loadassembly "System.ServiceProcess"
    sc = dotNetObject "System.ServiceProcess.ServiceController"
    if (server == "") do server = "." -- if no server is supplied, run the check on the local machine
    sc.Machinename = server
    try(scServices = sc.GetServices(server))catch(return "Timed Out")
    for scTemp in scServices do
    (
        if (scTemp.ServiceName as string == ServiceName) then
        (
            --print ( ServiceName + " - " + server + " - " +scTemp.Status.toString() )
            return scTemp.Status.ToString()
        )
    )
    return "Service Not found"
)

Initial URL

                                

Initial Description

                                

Initial Title
Check the status of a remote server's Service

Initial Tags
Net

Initial Language
Maxscript