Header Ads

  • New Updates

    Generate Print Report from Printer Server windows 2012 Using GeneratePrintJobAccountingReports.ps1


    I am not expert in script things, any way this the script I found and it work for me. Here I am explain some tips and solutions that I faced at implementing this script in production .
    (Before this configuration I have installed  installed Microsoft Printer server service and added all my network printer in my print management console.) 

    All codes you can download from below link,
    https://gallery.technet.microsoft.com/scriptcenter/Script-to-generate-print-84bdcf69#content

    Do the all setups as what script explain.

    This script reads event log ID 307 and ID 805 from the log "Applications and Services Logs > Microsoft > Windows > PrintService"
    from the specified server and for the specified time period and then calculates print job and total page count data from these 
    event log entries.
    It then writes the output to two .CSV files, one showing by-print job data and the other showing by-user print job data.
    The script depends on specific event log data and text in event log ID 307 and 805 records and has been tested only on 
    Windows Server 2008 R2 with SP1.
    Requirements:
    - Ensure the .NET Framework 3.5 or later is installed:
      - Add ".NET Framework 3.5.1" under the ".NET Framework 3.5.1 Features" option using the "Add Features" option of Server Manager, or 
      - All Programs > Accessories > Windows PowerShell > right-click Windows PowerShell > Run as administrator...
        Import-Module ServerManager
        Add-WindowsFeature NET-Framework-Core
    - Enable and configure print job event logging on the desired print server:
      - start Devices and Printers > (highlight any printer) > Print server properties > Advanced
        - check "Show informational notifications for local printers"
        - check "Show informational notifications for network printers"
          - OK
      - start Event Viewer > Applications and Services Logs > Microsoft > Windows > PrintService 
        - right-click Operational > Enable Log
        - right-click Operational > Properties > Maximum log size (KB): 65536 (was 1028 KB by default)
          - OK
    - Ensure that the user account used to run the script has write permission to the destination directory that will hold the
      output .CSV files ("D:\Scripts\" in the code below). Change the .CSV paths and filenames in the code below as desired.
    - If the print server is a remote server, ensure that the user account used to run the script has remote procedure call 
      network access to the specified hostname, and that firewall rules permit such network access.
    - If the print server is logging events using a language other than English, customize the ID 805 message search string below
      to match the language-appropriate string used in the print server's event ID 805 event log message.

    ====================================================================

    In addition, In printer server go to properties of the printer what you shared >share> clear the check mark from  "render print jobs on client computers"
    Otherwise you will not get report for  number of copies per printing , it only count number of pages. So make sure clear above option.

    Usage:

    To Generate Previous month Report ,

    If you are running this script from any remote server other then the printer server  Use below code otherwise you will get the error message "rpc server is unavailable" .

    If you are generating report from any remote pc use below code,
    For a particular period of date.
    powershell.exe -command `".\GeneratePrintJobAccountingReports.ps1 printserver.domain.local 08/01/2014 08/02/2014`" 
    For previous month report.
    powershell.exe -command `".\GeneratePrintJobAccountingReports.ps1 printserver.domain.local PreviousMonth`" 

    If you are running the script in same printer server use below code,

    To generate full report for previous month use below code. Make one schedule task running at 1st day of each month.
    powershell.exe -command `".\GeneratePrintJobAccountingReports.ps1 localhost PreviousMonth`" 
    To create report for a particular dates use below link.
    powershell.exe -command `".\GeneratePrintJobAccountingReports.ps1 localhost 08/01/2014 08/02/2014`" 
    Here  printserver.domain.local  is your printer server FQDN .

    To automatically generate report and send by e-mail follow below configuration,
    http://www.einfosite.com/2018/02/sending-email-from-command-line-using.html















    No comments

    Post Top Ad

    Post Bottom Ad

    Ads