= CreateObject("Scripting.FileSystemObject") if fso.FileExists("c: estfile.txt") Then set f = fso.GetFile("c: estfile.txt") f.delete End If
strComputer = InputBox("Enter Computer name", "Enter Name Here", "dc1.bgeek.com")
Set wbemServices = GetObject("winmgmts:\" & strComputer) Set wbemObjectSet = wbemServices.InstancesOf("Win32_Service") Set f = fso.CreatetextFile("c: estfile.txt", ForAppending, True)
For Each wbemObject In wbemObjectSet f.write "Display Name: " & wbemObject.DisplayName & VBCrLf f.write "State: " & wbemObject.State & VBCrLf f.write "Start Mode: " & wbemObject.StartMode & VBCrLf Next
set wbemServices = nothing set wbemObjectset = nothing set fso = nothing set f = nothing msgbox "Done!" blog comments powered by Disqus