Useful Script for NTFRS Service Restart

'AUTHOR: ale1v'DATE : 14.5.2006
'COMMENT: Restart NTFRS Service Windows 2003

strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colRunningServices = objWMIService.ExecQuery _
("Select * from Win32_Service")
Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name='NTFRS'")

For Each objService in colServiceListStatus = objService.State
If Status="Running" Then
objService.StopService()x=1ElseobjService.StartService()
x=0
End if
Next
If x=1 Then
wscript.sleep 10000
Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name='NTFRS'")
For Each objService in colServiceListobjService.StartService()
Next
end if

No comments:

Recent Posts