Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

log file

Status
Not open for further replies.

crpytocrzy

Technical User
Aug 9, 2021
1
GB
Hi All,

I have the below to start the spooler service if not running , I would like to create logfile to write out a file everytime its runs.
Any help would be appreciated. I am a complete beginner so please take it easy :)



Set wmi = GetObject("winmgmts://./root/cimv2")

qry = "SELECT * FROM Win32_Service WHERE Name = 'spooler'"
For Each svc In wmi.ExecQuery(qry)
If svc.State <> "Running" Then svc.StartService
Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top