17 lines
642 B
PowerShell
17 lines
642 B
PowerShell
# Specify the directory containing the XML files
|
|
$xmlDirectory = "C:\Scripts\Printers\03-Printer-Preferences"
|
|
|
|
# Get all XML files in the directory
|
|
$xmlFiles = Get-ChildItem -Path $xmlDirectory -Filter "*.xml"
|
|
|
|
# Iterate through each XML file
|
|
foreach ($xmlFile in $xmlFiles) {
|
|
# Extract printer name from the file name (without .xml)
|
|
$printerName = $xmlFile.BaseName
|
|
|
|
# Use the full file name (with .xml) as PrintTicketXML
|
|
$printTicketXml = [xml](Get-Content $xmlFile.FullName)
|
|
|
|
# Set the printer configuration
|
|
Set-PrintConfiguration -PrinterName $printerName -PrintTicketXML $printTicketXml.InnerXml
|
|
} |