Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SSIS package when executed as Job not printing even the job executes successfully!

SSIS package when executed as Job not printing even the job executes successfully!

Scheduled Pinned Locked Moved Database
helpcsharphtmldatabasesql-server
9 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SIJUTHOMASP
    wrote on last edited by
    #1

    HI, Having the following issue and would really appreciate any help/guidence.. We have one SSIS package it will print an html page located in specific location according to the printer name getting from the table. This is working fine and printing to the installed printer on the server. When we have scheduled a job , which executes the SSIS package it was printing fine in one server and which is 32 bit machine and not printing in 64 bit machine. In more detail, the job is executing fine and showing the steps success. The log file showing the status that send to the printer. but in 64 bit machine it is not giving print out..No issues with the printer.. Suspecting some permission issue with sql agent on that machine.. Please help me to fix it out as it is eating my head!:confused: Thanks, Rahul.

    SoftwareDeveloper(.NET)

    W 1 Reply Last reply
    0
    • S SIJUTHOMASP

      HI, Having the following issue and would really appreciate any help/guidence.. We have one SSIS package it will print an html page located in specific location according to the printer name getting from the table. This is working fine and printing to the installed printer on the server. When we have scheduled a job , which executes the SSIS package it was printing fine in one server and which is 32 bit machine and not printing in 64 bit machine. In more detail, the job is executing fine and showing the steps success. The log file showing the status that send to the printer. but in 64 bit machine it is not giving print out..No issues with the printer.. Suspecting some permission issue with sql agent on that machine.. Please help me to fix it out as it is eating my head!:confused: Thanks, Rahul.

      SoftwareDeveloper(.NET)

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      If the printer is not connected directly to the server, but is a ntwork printer, check that the account you are using for agent has access to the printer in the domain. For example the account isn't local system, but a domain account and has sufficient privileges on domain level.

      The need to optimize rises from a bad design. My articles[^]

      S 1 Reply Last reply
      0
      • W Wendelius

        If the printer is not connected directly to the server, but is a ntwork printer, check that the account you are using for agent has access to the printer in the domain. For example the account isn't local system, but a domain account and has sufficient privileges on domain level.

        The need to optimize rises from a bad design. My articles[^]

        S Offline
        S Offline
        SIJUTHOMASP
        wrote on last edited by
        #3

        Hi Mika, Thanks for the reply.Appreciating. The printer is a n/w printer. The account used for the agent has access to the printer. The account used is the admin user for the server. Another one thing I have noticed is that, when we execute the package as sql utility it is not printing but when we execute the package manually from the folder it is printing.. Will this info help you to provide some more guidence? Thanks, Rahul.

        SoftwareDeveloper(.NET)

        W 1 Reply Last reply
        0
        • S SIJUTHOMASP

          Hi Mika, Thanks for the reply.Appreciating. The printer is a n/w printer. The account used for the agent has access to the printer. The account used is the admin user for the server. Another one thing I have noticed is that, when we execute the package as sql utility it is not printing but when we execute the package manually from the folder it is printing.. Will this info help you to provide some more guidence? Thanks, Rahul.

          SoftwareDeveloper(.NET)

          W Offline
          W Offline
          Wendelius
          wrote on last edited by
          #4

          What is the command you're using for printing (sp's involved etc)?

          The need to optimize rises from a bad design. My articles[^]

          S 1 Reply Last reply
          0
          • W Wendelius

            What is the command you're using for printing (sp's involved etc)?

            The need to optimize rises from a bad design. My articles[^]

            S Offline
            S Offline
            SIJUTHOMASP
            wrote on last edited by
            #5

            Here is the code used in the SSIS to print. Procedures used to retrive the printer name. The thing is that , it is updating the log file as doc send to the printer.. for eg: doc1 send to the printer \\nw path\printer name. One more differenc I noticed is that, in that 32 bit machine where it is printing fine having IIS installed but the 64 bit machine not having IIS installed..Will this affect when print using a job ?

                PrintStatus("PrintStatus").Value = 3
                flgFindPrinter = False
                AttemptCount = -1
            
                While (Not flgFindPrinter And AttemptCount < MaxRetryAttempts("MaxRetryAttempts").Value)
                    Dim prnDoc As New System.Drawing.Printing.PrintDocument
                    For Each prn As String In prnDoc.PrinterSettings.InstalledPrinters
                        If prn.ToLower = PrinterName("PrinterName").Value.ToString.ToLower Then
                            flgFindPrinter = True
                        End If
                    Next
            
                    PrintStartTime("PrintStartTime").Value = Date.Now
            
                    If flgFindPrinter Then
                        defaultPrinter = prnDoc.PrinterSettings.PrinterName
            
                        Dim wsNetwork As Object
                        Try
                            wsNetwork = CreateObject("WScript.Network")
                            wsNetwork.SetDefaultPrinter(PrinterName("PrinterName").Value)
            
                            Dim IE As Object = CreateObject("InternetExplorer.Application")
                            IE.navigate(FolderPath("AbsoluteFolderPath").Value & DocName("DocName").Value)
            
                            While (IE.QueryStatusWB(6) <> 3)
                                Threading.Thread.Sleep(500)
                            End While
            
                            IE.ExecWB(6, 2, Nothing, Nothing)
            
                            Dts.Events.FireInformation(1000, "Print Document", FolderPath("AbsoluteFolderPath").Value & DocName("DocName").Value & " Successfully Printed to " & PrinterName("PrinterName").Value, "", 0, False)
                        Catch ex As Exception
                            Dts.Events.FireInformation(2000, "Print Document", ex.Message, "", 0, False)
                            PrintStatus("PrintStatus").Value = 2
                        Finally
                            If wsNetwork IsNot Nothing Then wsNetwork.SetDefaultPrinter(defaultPrinter)
                        End Try
            
                    Else
                        Dts.Events.FireInformation(2000, "Print Document", PrinterName("PrinterName").Value & " Not Found", "", 0, False)
                        PrintStatus("PrintStatus").Value = 2
                    End If
                    Atte
            
            S 1 Reply Last reply
            0
            • S SIJUTHOMASP

              Here is the code used in the SSIS to print. Procedures used to retrive the printer name. The thing is that , it is updating the log file as doc send to the printer.. for eg: doc1 send to the printer \\nw path\printer name. One more differenc I noticed is that, in that 32 bit machine where it is printing fine having IIS installed but the 64 bit machine not having IIS installed..Will this affect when print using a job ?

                  PrintStatus("PrintStatus").Value = 3
                  flgFindPrinter = False
                  AttemptCount = -1
              
                  While (Not flgFindPrinter And AttemptCount < MaxRetryAttempts("MaxRetryAttempts").Value)
                      Dim prnDoc As New System.Drawing.Printing.PrintDocument
                      For Each prn As String In prnDoc.PrinterSettings.InstalledPrinters
                          If prn.ToLower = PrinterName("PrinterName").Value.ToString.ToLower Then
                              flgFindPrinter = True
                          End If
                      Next
              
                      PrintStartTime("PrintStartTime").Value = Date.Now
              
                      If flgFindPrinter Then
                          defaultPrinter = prnDoc.PrinterSettings.PrinterName
              
                          Dim wsNetwork As Object
                          Try
                              wsNetwork = CreateObject("WScript.Network")
                              wsNetwork.SetDefaultPrinter(PrinterName("PrinterName").Value)
              
                              Dim IE As Object = CreateObject("InternetExplorer.Application")
                              IE.navigate(FolderPath("AbsoluteFolderPath").Value & DocName("DocName").Value)
              
                              While (IE.QueryStatusWB(6) <> 3)
                                  Threading.Thread.Sleep(500)
                              End While
              
                              IE.ExecWB(6, 2, Nothing, Nothing)
              
                              Dts.Events.FireInformation(1000, "Print Document", FolderPath("AbsoluteFolderPath").Value & DocName("DocName").Value & " Successfully Printed to " & PrinterName("PrinterName").Value, "", 0, False)
                          Catch ex As Exception
                              Dts.Events.FireInformation(2000, "Print Document", ex.Message, "", 0, False)
                              PrintStatus("PrintStatus").Value = 2
                          Finally
                              If wsNetwork IsNot Nothing Then wsNetwork.SetDefaultPrinter(defaultPrinter)
                          End Try
              
                      Else
                          Dts.Events.FireInformation(2000, "Print Document", PrinterName("PrinterName").Value & " Not Found", "", 0, False)
                          PrintStatus("PrintStatus").Value = 2
                      End If
                      Atte
              
              S Offline
              S Offline
              SIJUTHOMASP
              wrote on last edited by
              #6

              OOPS Finally, the issue got resolved!! After analysing more into it has been revealed the following was the casue.. The SSIS package is creating IExplorer.exe and when more IExplorer.exe are there in the process then it is getting stuck or wierd. by this the packet send by the job not able to print some time.. This is resolved by using Quit method of the IE object in the program after creation... Thanks, Rahul.. :-O

              SoftwareDeveloper(.NET)

              W 1 Reply Last reply
              0
              • S SIJUTHOMASP

                OOPS Finally, the issue got resolved!! After analysing more into it has been revealed the following was the casue.. The SSIS package is creating IExplorer.exe and when more IExplorer.exe are there in the process then it is getting stuck or wierd. by this the packet send by the job not able to print some time.. This is resolved by using Quit method of the IE object in the program after creation... Thanks, Rahul.. :-O

                SoftwareDeveloper(.NET)

                W Offline
                W Offline
                Wendelius
                wrote on last edited by
                #7

                I was just investigating the proc and noticed the same. Another thing is that if I'm reading correctly, your log file will show successfull send if the printer is found even if the printing itself goes to an exception. But anyway, main thing is you got it solved, Mika

                The need to optimize rises from a bad design. My articles[^]

                S 1 Reply Last reply
                0
                • W Wendelius

                  I was just investigating the proc and noticed the same. Another thing is that if I'm reading correctly, your log file will show successfull send if the printer is found even if the printing itself goes to an exception. But anyway, main thing is you got it solved, Mika

                  The need to optimize rises from a bad design. My articles[^]

                  S Offline
                  S Offline
                  SIJUTHOMASP
                  wrote on last edited by
                  #8

                  Yes Mika, you are right as the program will write a sucessfull update to the log even if it fails after finding the printer successfully.. Thaks much for your responses.I appreciate that!

                  SoftwareDeveloper(.NET)

                  W 1 Reply Last reply
                  0
                  • S SIJUTHOMASP

                    Yes Mika, you are right as the program will write a sucessfull update to the log even if it fails after finding the printer successfully.. Thaks much for your responses.I appreciate that!

                    SoftwareDeveloper(.NET)

                    W Offline
                    W Offline
                    Wendelius
                    wrote on last edited by
                    #9

                    No problem :)

                    The need to optimize rises from a bad design. My articles[^]

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups