User Tools

Site Tools


microsoft:scripting:vbscript:scripts:restartprintspooler

Versie 1

Stopt de Print Spooler service, wacht 60 seconden en start 'm weer. Wacht vervolgens nog 30 seconden en start 'm weer, voor het geval de service problemen heeft met opstarten.

'RestartPrintSpooler.vbs
'Voor het stoppen en starten van de Print Spooler service.
'20091202, v1

On Error Resume Next

strComputer = "."

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

'Win32_Service: http://msdn.microsoft.com/en-us/library/aa394418(VS.85).aspx
Set colServices = objWMIService.ExecQuery("SELECT * FROM Win32_Service")

For Each objService In colServices

	If Instr(objService.DisplayName, "Print Spooler") > 0 Then

		objService.StopService()
		
		WScript.Sleep 60000
		
		objService.StartService()
		
		WScript.Sleep 30000
		
		objService.StartService()

	End If

Next

Set colServices = Nothing
Set objWMIService = Nothing
microsoft/scripting/vbscript/scripts/restartprintspooler.txt · Last modified: 2009/12/02 11:38 by bas

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki