Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for services.kix

(view source code of services.kix as plain text)

  1. ; Check KiXtart version
  2. $KixMajorVer = SubStr( @Kix, 1, InStr( @Kix, "." ) - 1 )
  3. If $KixMajorVer < 4
  4. 	Syntax()
  5. EndIf
  6.  
  7. ; Query and display running processes
  8. $objWMIService = GetObject( "winmgmts://./root/cimv2" )
  9. ; Display error number and description if applicable
  10. If $Err.Number
  11. 	ShowErr()
  12. EndIf
  13.  
  14. ; Collect information on services 
  15. $colItems = $objWMIService.ExecQuery( "Select * from Win32_Service", , 48 )
  16.  
  17. ; Display results
  18. For Each $objItem in $colItems
  19. 	? "Name:        " + $objItem.Name
  20. 	? "DisplayName: " + $objItem.DisplayName
  21. 	? "PathName:    " + $objItem.PathName
  22. 	? "StartMode:   " + $objItem.StartMode
  23. 	? "State:       " + $objItem.State
  24. 	? "StartName:   " + $objItem.StartName
  25. 	?
  26. Next
  27.  
  28. ; Done
  29. Quit 0
  30.  
  31.  
  32. Function ShowErr
  33. 	? "Error # " + $Err.Number
  34. 	? $Err.Description
  35. 	?
  36. 	Syntax
  37. EndFunction
  38.  
  39.  
  40. Function Syntax
  41. 	? "Services.kix,  Version 1.00"
  42. 	? "Display all services on local computer"
  43. 	?
  44. 	? "Usage:  KIX32  SERVICES.KIX"
  45. 	?
  46. 	? "Written by Rob van der Woude"
  47. 	? "http://www.robvanderwoude.com"
  48. 	?
  49. 	? "This script needs KiXtart version 4.* or later."
  50. 	? "Your KiXtart version is @KIX."
  51. 	?
  52. 	Quit 1
  53. EndFunction
  54.  

page last modified: 2024-04-16; loaded in 0.0055 seconds