We Recommend

C++ The Core Language C++ The Core Language
C++: The Core Language is for C programmers transitioning to C++. It's designed to get readers up to speed quickly by covering an essential subset of the language. The subset consists of features without which it's just not C++, and a handful of others that make it a reasonably useful language.


Posted By

vsai on 12/15/08


Tagged

Net Services maxscript


Versions (?)


Check the status of a remote server's Service


Published in: Maxscript 


  1. fn checkService ServiceName server =
  2. (
  3. dotnet.loadassembly "System.ServiceProcess"
  4. sc = dotNetObject "System.ServiceProcess.ServiceController"
  5. if (server == "") do server = "." -- if no server is supplied, run the check on the local machine
  6. sc.Machinename = server
  7. try(scServices = sc.GetServices(server))catch(return "Timed Out")
  8. for scTemp in scServices do
  9. (
  10. if (scTemp.ServiceName as string == ServiceName) then
  11. (
  12. --print ( ServiceName + " - " + server + " - " +scTemp.Status.toString() )
  13. return scTemp.Status.ToString()
  14. )
  15. )
  16. return "Service Not found"
  17. )

Report this snippet 

You need to login to post a comment.