6/1/09

Printer Clear Out VBS Script

strComputer = "."Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery _("Select * from Win32_Service where Name = 'Spooler'")
For Each objService in colServiceListIf objService.State = "Running" ThenobjService.StopService()Wscript.Sleep 5000End If
Set FileList = objWMIService.ExecQuery _("ASSOCIATORS OF {Win32_Directory.Name='C:\Windows\system32\spool\printers'} Where " _& "ResultClass = CIM_DataFile")
For Each objFile In FileListobjFile.DeleteNext
Next

No comments: