Loading |
VBScript |
JavaScript |
Powershell |
Search Options: Print Text Files to a Printer Other than the Default PrinterContent of Print Text Files to a Printer Other than the Default Printer.vbsMD5 Hash: 8DF5B3CE62632217531CF360881CD800 |
||
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colPrinters = objWMIService.ExecQuery _ ("Select * from Win32_Printer Where Default = TRUE") For Each objPrinter in colPrinters strOldDefault = objPrinter.Name strOldDefault = Replace(strOldDefault, "\", "\\") Next Set colPrinters = objWMIService.ExecQuery _ ("Select * from Win32_Printer Where Name = '\\\\atl-ps-01\\printer2'") For Each objPrinter in colPrinters objPrinter.SetDefaultPrinter() Next Wscript.Sleep 2000 TargetFolder = "C:\Logs" Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.Namespace(TargetFolder) Set colItems = objFolder.Items For Each objItem in colItems objItem.InvokeVerbEx("Print") Next Set colPrinters = objWMIService.ExecQuery _ ("Select * from Win32_Printer Where Name = '" & strOldDefault & "'") For Each objPrinter in colPrinters objPrinter.SetDefaultPrinter() Next | ||
© 2008 - 2013 Boris Toll :: Scripts available: 6.481 :: :: scriptbox.toll.at :: :: powered by www.toll.at :: |