2
0
2024-12-10 08:15:02 -06:00

21 lines
833 B
PowerShell

# Only run the this export script once all printers desired preferences have been set or if preferences have been tweaked, then run once again.
# Specify the desired output directory
$outputDirectory = "C:\Scripts\Printers\03-Printer-Preferences"
# Specify printers to ignore (adjust as needed)
$printersToIgnore = "Fax", "Microsoft Print to PDF", "Microsoft XPS Document Writer"
# Get a list of all printers
$printers = Get-Printer
$printers = $printers | Where-Object { $printersToIgnore -notcontains $_.Name }
# Iterate through each printer
foreach ($printer in $printers) {
# Get the printer configuration
$printerConfig = Get-PrintConfiguration -PrinterName $printer.Name
# Export the PrintTicket as XML
$printerConfig.PrintTicketXML | Out-File "$outputDirectory\$($printer.Name).xml"
}