You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何用PowerShell导入/导出Zebra打印机可读.DRS配置文件?

问题:批量导出/导入Zebra打印机可读.DRS配置文件

我有30多台Windows Server 2012 R2服务器,每台部署了30多台Zebra打印机,需求是通过PowerShell实现导入和导出打印管理UI中“首选项”“默认值”路径下的人类可读.DRS格式配置文件。

以下是已尝试的方案及遇到的问题:

  • 使用RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry进行配置导入导出:生成的文件可读性极差,不符合.DRS文件的存储规范,且无法成功导入配置。
  • 考虑过注册表操作:由于Zebra打印机在Devmode项中包含自定义设置,并非简单导出注册表再转换就能实现需求。
  • 使用Get-PrintConfiguration和Get-CimInstance命令:输出结果中无法找到Darkness、Speed等关键参数,相关代码及输出示例如下:

相关代码

$printerName = "Zebra_1" 
$compNameSource = $env:COMPUTERNAME
$Printer = Get-CimInstance -ClassName Win32_Printer -Filter "Name='$PrinterName'"
$somePrinterConfig = Get-PrintConfiguration -ComputerName $compNameSource  -PrinterName $printerName
$Printer.PSObject.Properties | ForEach-Object {
    $_.Name, $_.Value
}
$somePrinterConfig.PSObject.Properties | ForEach-Object {
    $_.Name, $_.Value
}

命令输出示例

Name            : Caption
Value           : Zebra_1
CimType         : String
Flags           : Property, ReadOnly, NotModified
IsValueModified : False
Name            : Description
Value           : 
CimType         : String
Flags           : Property, ReadOnly, NotModified, NullValue
....

目标.DRS文件示例

[FileInfo]
Type=Driver Configuration File
Printer Type=201
[Barcodes]
BarcodeNum=6
[BARFONT0]
Name=EAN 13
UseHeight=1
JoinMode=2
StripTrailingSpaces=1
Kind=0
ID=1
Height=160
Expansion=1
Ratio=16908546
Flags=6164
…
[Parameters]
PaperSize=256
FormName=U
PageWidth=508
PageHeight=254
HDPI=300
VDPI=300
Orientation=3
Quantity=1
Cutter=0
BatchCut=0
Darkness=26
Speed=2
…

内容的提问来源于stack exchange,提问作者casewolf

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.08 09:15:22