Many times, we need to check if particular service is running or not on some particular server. Then we need to log into that server to check it.
To simplify it, I wrote a VBScript that will get the information for you from that server without login to the server.
Important NOTE: To get the service information, you need to run this VBScript with the account that has admin rights on the server for which you need the service information.
VBScript will point to below screen: Enter server name and click Ok.
It will create Service_Info.txt at the root location from where you are running the script.
Format of output log file:
Service Name::- Application Experience Lookup Service
Description::- Processes application compatibility lookup requests for applications as they are launched.
Status::- Running
Startup Type ::- Auto
Log on as ::- LocalSystem
VBScript Content:
'##############################################################'#'# Language VBscript'#'# Author Mohd Aslam'# Date 28.06.2011'# Description This script does following actions:'# 1) it asks user to input the name of server
'# whose service info you want'# 2) It then creates Service_Info.txt file in'# the directory of the script file.
'#'#############################################################Dim oFSO 'File Scripting ObjectDim sScriptLog 'output log filenameDim oScriptLog 'Script output file objectDim oWshShell 'Windows Scripting Shell objectsScriptLog = ".\Service_Info.txt"
Set oWshShell = WScript.CreateObject("WScript.Shell")Set oFSO = CreateObject("Scripting.FileSystemObject")Set oScriptLog = oFSO.CreateTextFile (sScriptLog,True)
oScriptLog.Close()Set oScriptLog = oFSO.OpenTextFile(sScriptLog,8)
InputServerName = InputBox("Enter the name of server whose service information you want:","Service Information")strComputer = InputServerNameSet objWMIService = GetObject("winmgmts:" _& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")Set colRunningServices = objWMIService.ExecQuery _
("Select * from Win32_Service")
For Each objService in colRunningServicesoScriptLog.WriteLine "Service Name::- " & objService.DisplayName & VbCrLf
oScriptLog.WriteLine "Description::- " & objService.Description & VbCrLf
oScriptLog.WriteLine "Status::- " & objService.State & VbCrLf
oScriptLog.WriteLine "Startup Type ::- " & objService.startmode & VbCrLf
oScriptLog.WriteLine "Log on as ::- " & objService.startname & VbCrLf
oScriptLog.WriteLine "-------------------------------------------" & VbCrLf
Next
–End of Article–