Get-PrintJob appending to existing CSV

Welcome Forums General PowerShell Q&A Get-PrintJob appending to existing CSV

This topic contains 1 reply, has 2 voices, and was last updated by

5 years, 5 months ago.

  • Author
  • #10779

    Points: 0
    Rank: Member

    Hi users

    I'm trying to get overview of the printqueue of a specific printer.

    I'm able to get what I need from the following command

    Get-PrintJob -PrinterName \\printserver\printer| select -Property ComputerName, DocumentName, Position, PrinterName, SubmittedTime, TotalPages, Username | Export-Csv c:\temp\printqueue.csv

    But I need a way of appending new jobs (and not adding perse and not adding a job that is already on it) to the csv file.

    How would I do this?

  • #10790

    Points: 0
    Rank: Member

    If you are using PowerShell 3.0 or 4.0 then Export-csv gets an -Append parameter that will allow you to add records to a CSV file. The kicker is in your requirement to not add a job that already exists.

    I suspect that you'll need to read the CSV file into an array; get the current print jobs; add them to the array; select for unique jobs and export the CSV.

    From the list of properties you are selecting what are you going to use to uniquely identify a job?

The topic ‘Get-PrintJob appending to existing CSV’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort