Return to Snippet

Revision: 30897
at August 25, 2010 02:37 by hecUngravity


Initial Code
set shell = WScript.CreateObject("WScript.Shell")
resultPath = "c:\Scripts\Resultados\Servicios.txt"


Set ComputerObj = GetObject("WinNT://" & shell.ExpandEnvironmentStrings("%ComputerName%"))
ComputerObj.Filter = Array("Service")
   Dim fso, tf
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set tf = fso.CreateTextFile(resultPath, True)
   ' Escribir una l�­nea con un car�¡cter nueva l�­nea.
For Each Service in ComputerObj

If Service.Name = "aspnet_state" or Service.Name = "OSearch" or Service.Name = "MSSQLSERVER" or Service.Name = "MSSQLServerOLAPService" or Service.Name = "MsDtsServer100" or Service.Name = "ReportServer" or Service.Name = "SPAdmin" or Service.Name = "SPSearch" or Service.Name = "SPTimerV3" or Service.Name = "SPTrace" or Service.Name = "SPWriter" Then


	tf.WriteLine( VbCrLf & "--------------------------------------------------" & VbCrLf )

	tf.WriteLine("Nombre Real Servicio: " & Service.Name)
	tf.WriteLine("Nombre de Servicio: " & Service.Displayname)
	tf.WriteLine("Ruta del Servicio: " & Service.Path)

	Dim estado,s
	s=Service.status 
	Select Case s
		Case 1
		estado = "Detenido"
		Case 2
		estado = "Iniciando"
		Case 3
		estado = "Deteniendo"
		Case 4
		estado = "Iniciado"
		Case 5
		estado = "Continuando"
		Case 6
		estado = "Pausando"
		Case 7
		estado = "Pausado"
	End Select


	tf.WriteLine("Estado del Servicio: " & estado)
	tf.WriteLine("Cuenta del Servicio: " & Service.ServiceAccountName)




end If
Next


tf.WriteLine( VbCrLf & "--------------------------------------------------")

tf.Close



shell.Run "notepad " & resultPath

Initial URL

                                

Initial Description

                                

Initial Title
list computer services

Initial Tags

                                

Initial Language
Visual Basic