Custom Search

Wednesday, March 25, 2009

Start the Services through QTP

strComputer = "."
strService = " 'W32Time' "
Set objWMIService = GetObject("winmgmts:"& _ "{impersonationLevel=impersonate}!\\"& strComputer & "\root\cimv2")Set colListOfServices = objWMIService.ExecQuery("Select * from _ Win32_Service Where Name ="& strService & " ")
For Each objService in colListOfServices
objService.StartService()
Next

Note : here strService is Services Name which you are going to start. you get this name from control panel\Administrative Tools\Services... and right click and select properties on the Service , here you can find Service Name.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.