By Request Script To Send Service Display Name And Path Name To A Text File

 

This By Request VBS script will send service display names and paths to a text file.

 

VBS Script:

 

strComputer = InputBox ("Enter Machine Name")

 

Const ForAppending = 8

 

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objTextFile = objFSO.OpenTextFile("Output.Txt", ForAppending, True)

 

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_Service")

 

For Each objItem in colItems

objTextFile.WriteLine(objItem.DisplayName & ": " & objItem.PathName)

Next

 

objTextFile.Close

MsgBox "Done"

 

 

 

Published Sunday, August 24, 2008 1:03 PM by dhite
Filed under:

Comments

No Comments