Keep Printed Documents

Home Forums Scripting Windows Script Host Keep Printed Documents

This topic contains 7 replies, has 5 voices, and was last updated by Avatar nicatnite303 8 years, 2 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • Avatar
    Elawady
    Member
    #155343

    Hay , i wish this Post find you good
    i have a little problem that i want to save printed documents
    i use this script

    strComputer = “.”
    Set objWMIService = GetObject(“winmgmts:\” & strComputer & “rootcimv2”)

    Set colPrinters = objWMIService.ExecQuery(“Select * From Win32_Printer”)

    For Each objPrinter in colPrinters
    objPrinter.KeepPrintedJobs = true

    objPrinter.Put_

    objPrinter.RawOnly = true
    Next

    but still have one problem that some printer driver dose not work and gives me a corrupted .SPL file
    by the way all workstation windows Xp AD is 2003
    any other solution to keep printed documents
    Thansk
    Thanks

    Avatar
    Ossian
    Moderator
    #184605

    Re: Keep Printed Documents

    Nothing to do with AD
    Moved to scripting forum

    Avatar
    nicatnite303
    Member
    #382343

    Re: Keep Printed Documents

    any new scripts

    Avatar
    Ossian
    Moderator
    #184606

    Re: Keep Printed Documents

    Give people a chance please — its only been 10 minutes since your original post.
    If you require immediate help, Microsoft Product Support will be delighted to help you — all major credit cards accepted :twisted:

    tehcamel
    tehcamel
    Moderator
    #357766

    Re: Keep Printed Documents

    have you talked to the printer manufacturer about it?
    have you tried different drivers… ?
    maybe some of these printers just don’t support the function you’re trying to configure ?

    Rems
    Rems
    Moderator
    #228018

    Re: Keep Printed Documents

    Elawady;241685 wrote:
    Hay , i wish this Post find you good
    i have a little problem that i want to save printed documents
    i use this script

    strComputer = “.”
    Set objWMIService = GetObject(“winmgmts:\” & strComputer & “rootcimv2”)

    Set colPrinters = objWMIService.ExecQuery(“Select * From Win32_Printer”)

    For Each objPrinter in colPrinters
    objPrinter.KeepPrintedJobs = true

    objPrinter.Put_

    objPrinter.RawOnly = true
    Next

    but still have one problem that some printer driver dose not work and gives me a corrupted .SPL file
    by the way all workstation windows Xp AD is 2003
    any other solution to keep printed documents
    Thansk
    Thanks

    Are you using the script to edit the attributes of mapped network printers or locally installed printers? You must have admin rights on each of the printers to run this script. You running the script on the print server op on the clients?

    btw, when using objPrinter.Put_ you should add a certain service privilege for making it work also for hardware drivers that not exist in the Driver.cab file on the computer.
    Set objWMIService = GetObject _
    (“winmgmts:{impersonationLevel=impersonate}!rootcimv2”)

    objWMIService.Security_.Privileges._
    AddAsString “Se[B]LoadDriver[/B]Privilege”, True[/CODE]
    Corrupted SHD files or its corresonding SPL file is not realy a scripting issue. Have you tried start/stopping the Printer Spooler services and cleared the Spool folder once?

    You wrote “some printers does not work and gives me a corrupted .SPL file”, how you know the files are currupted? – any error messages?
    Are those drivers for printer devices (hardware) or for a software product? Are they signed drivers?

    In the printer’s queue do you see the document’s status is “sent to the printer” – and was the document actually printed the first time?

    Have you checked the Access Control Entries on the printer and also the permissions for the spool directory that this particular printer actually is configured to use.

    /Rems[CODE]Set objWMIService = GetObject _
    (“winmgmts:{impersonationLevel=impersonate}!rootcimv2”)

    objWMIService.Security_.Privileges._
    AddAsString “SeLoadDriverPrivilege”, True[/CODE]
    Corrupted SHD files or its corresonding SPL file is not realy a scripting issue. Have you tried start/stopping the Printer Spooler services and cleared the Spool folder once?

    You wrote “some printers does not work and gives me a corrupted .SPL file”, how you know the files are currupted? – any error messages?
    Are those drivers for printer devices (hardware) or for a software product? Are they signed drivers?

    In the printer’s queue do you see the document’s status is “sent to the printer” – and was the document actually printed the first time?

    Have you checked the Access Control Entries on the printer and also the permissions for the spool directory that this particular printer actually is configured to use.

    /Rems

    Avatar
    nicatnite303
    Member
    #382344

    Re: Keep Printed Documents

    Thanks you Rems

    I use this script to locally installed printers

    also i use deployment software to gain Administrator rights.

    SPL corrupted file dose not work with any viewer like (Spl View) software

    event if i tried to open this file online
    i seems corrupted format but the file is printed and saved in print spool
    the important this is the print processor to make sure it is configured as Winprint and REW for defualt data type this is my workshop but till now im not able to save all printed document in my whole network

    thank you again for your support

    Rems
    Rems
    Moderator
    #228022

    Re: Keep Printed Documents

    Elawady;242143 wrote:
    SPL corrupted file dose not work with any viewer like (Spl View) software
    the important this is the print processor to make sure it is configured as Winprint and RAW for default data type

    this script show which print processor each local printer is using:

    Set objWMIService = GetObject( _
    “winmgmts:{impersonationLevel=Impersonate ,” _
    & “(LoadDriver)}!//./root/cimv2”)

    Set colInstalledPrinters = objWMIService.ExecQuery _
    (“Select * from Win32_Printer Where ([B]Local[/B]=TRUE and NetworkTRUE)”)

    For Each objPrinter in colInstalledPrinters

    spl = “Start spool Printing immediately: True”
    If objPrinter.SpoolEnabled = False Then
    spl = “* Printer queue disabled! *”
    ElseIf objPrinter.Queued = True then
    spl = “Start Spool printing immediately: False”
    End If

    Wscript.Echo “Name” & vbTab & vbTab & “:”, objPrinter.Name & _
    vbNewLine & “Print Processor” & vbTab & “:”, objPrinter.printprocessor & _
    vbNewLine & “Data Type” & vbTab & “:”, objPrinter.PrintJobDataType & _
    vbNewLine & “Keep printed jobs” & vbTab & “:”, CStr(objPrinter.KeepPrintedJobs) & _
    vbNewLine & spl & _
    vbNewLine & “Port name” & vbTab & “:”, objPrinter.PortName

    Next

    Set objWMIService = Nothing
    Set colInstalledPrinters = Nothing[/CODE]

    If the script returns the info as expected then most likely ‘Spl View’ or the installed ‘printer driver’ is the problem.

    /Rems[CODE]
    Set objWMIService = GetObject( _
    “winmgmts:{impersonationLevel=Impersonate ,” _
    & “(LoadDriver)}!//./root/cimv2”)

    Set colInstalledPrinters = objWMIService.ExecQuery _
    (“Select * from Win32_Printer Where (Local=TRUE and NetworkTRUE)”)

    For Each objPrinter in colInstalledPrinters

    spl = “Start spool Printing immediately: True”
    If objPrinter.SpoolEnabled = False Then
    spl = “* Printer queue disabled! *”
    ElseIf objPrinter.Queued = True then
    spl = “Start Spool printing immediately: False”
    End If

    Wscript.Echo “Name” & vbTab & vbTab & “:”, objPrinter.Name & _
    vbNewLine & “Print Processor” & vbTab & “:”, objPrinter.printprocessor & _
    vbNewLine & “Data Type” & vbTab & “:”, objPrinter.PrintJobDataType & _
    vbNewLine & “Keep printed jobs” & vbTab & “:”, CStr(objPrinter.KeepPrintedJobs) & _
    vbNewLine & spl & _
    vbNewLine & “Port name” & vbTab & “:”, objPrinter.PortName

    Next

    Set objWMIService = Nothing
    Set colInstalledPrinters = Nothing[/CODE]

    If the script returns the info as expected then most likely ‘Spl View’ or the installed ‘printer driver’ is the problem.

    /Rems

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.