Powershell:将XML属性指定为CSV

时间:2016-10-05 19:57:47

标签: xml powershell csv

我正在尝试从XML文件中提取特定属性并将其导出为CSV。我尝试了一些方法,到目前为止,我没有得到我正在寻找的东西。我只需要两个值 - LogicalName Name和Device HardwarePath。我已尝试使用dot方法,如$ xml.PointOfServiceConfig.ServiceObject.Device.LogicalName.Name - 虽然这确实有效,但我无法将这两个值放入单独的列中。我只想要一个具有Name值的列和一个具有HardwarePath值的列。下面是xml文件的一部分,供您观看。非常感谢您的时间和帮助。

<?xml version="1.0" encoding="utf-8"?>
<PointOfServiceConfig Version="1.0">
  <ServiceObject Type="PosPrinter" Name="ZPLSO">
    <Device HardwarePath="PRINTMANAGER">
  <LogicalName Name="PRINTMANAGER" />
  <Property Name="darkness" Value="0" />
  <Property Name="defaultfont" Value="0" />
  <Property Name="defaultfontsize" Value="28" />
  <Property Name="devicetype" Value="virtual" />
  <Property Name="DNSName" Value="" />
  <Property Name="DPI" Value="203" />
  <Property Name="enableAuditLog" Value="OFF" />
  <Property Name="interface" Value="ETHERNET" />
  <Property Name="isCutterEquipped" Value="No" />
  <Property Name="labellength" Value="800" />
  <Property Name="lHomeLeft" Value="10" />
  <Property Name="lHomeTop" Value="10" />
  <Property Name="mediatype" Value="Direct" />
  <Property Name="mirrorimage" Value="Off" />
  <Property Name="ModelName" Value="LP 2844-Z" />
  <Property Name="operationmode" Value="Tear Off" />
  <Property Name="orientation" Value="Off" />
  <Property Name="pagewidth" Value="400" />
  <Property Name="pollingInterval" Value="1" />
  <Property Name="PortName" Value="0.0.0.0" />
  <Property Name="portNumber" Value="9100" />
  <Property Name="PortType" Value="IP/WiFi" />
  <Property Name="printspeed" Value="2" />
  <Property Name="RecLinesToPaperCut" Value="4" />
  <Property Name="Trackingmode" Value="Continuous" />
  <Property Name="units" Value="Inches" />
 </Device>
 </ServiceObject>
 <ServiceObject Type="PosPrinter" Name="TM-H6000II">
 <Device HardwarePath="10.65.77.176">
  <LogicalName Name="C10176" />
  <Property Name="AsyncProcessingSize" Value="2" />
  <Property Name="AutoPowerOff" Value="-1" />
  <Property Name="ConfigurationFile" Value="epson/xml/Setting/TM-H6000IISetting.xml" />
  <Property Name="CoreVersion" Value="1.12.0001" />
  <Property Name="Custom1Color" Value="0xFF0000" />
  <Property Name="Cutter" Value="1" />
  <Property Name="DefaultCodePage" Value="997" />
  <Property Name="DefaultSlpClampTime" Value="0" />
  <Property Name="DeviceDesc" Value="EPSON TM-H6000II POSPrinter" />
  <Property Name="DeviceID" Value="36" />
  <Property Name="DeviceType" Value="1" />
  <Property Name="DirectIOEventTimeout" Value="5000" />
  <Property Name="epson.trace.file" Value="trace.log" />
  <Property Name="epson.trace.max.size" Value="1000" />
  <Property Name="epson.tracing" Value="false" />
  <Property Name="EPurasSupport" Value="TRUE" />
  <Property Name="FirmLogFileName" Value="Firmware.log" />
  <Property Name="FirmLogFileSize" Value="1000" />
  <Property Name="FirmNotifyAllProgressEvents" Value="0" />
  <Property Name="FirmProgressRange" Value="10" />
  <Property Name="FirmRecordLog" Value="1" />
  <Property Name="Halftone" Value="0" />
  <Property Name="InitializeResponseTimeout" Value="5000" />
  <Property Name="InitializeThreadTime" Value="1000" />
  <Property Name="InputBufferSize" Value="4096" />
  <Property Name="InputTimeout" Value="1000" />
  <Property Name="KanjiTwoWaysPrint" Value="0" />
  <Property Name="LogicalName" Value="C10176" />
  <Property Name="LogicalPortInterfaceName" Value="EPuras" />
  <Property Name="LogicalPortName" Value="ESDPRT001" />
  <Property Name="LogObject" Value="" />
  <Property Name="MemorySwitch" Value="0" />
  <Property Name="NVRAMControlLevel" Value="1" />
  <Property Name="OfflineCount" Value="1" />
  <Property Name="OfflineRetryIntervalTime" Value="100" />
  <Property Name="OutputBufferSize" Value="32768" />
  <Property Name="OutputCompleteType" Value="2" />
  <Property Name="OutputErrorOption" Value="0" />
  <Property Name="OutputTimeout" Value="2000" />
  <Property Name="PageModeExt" Value="0" />
  <Property Name="Peeler" Value="0" />
  <Property Name="PhysicalDevice" Value="TM-H6000II" />
  <Property Name="PhysicalPrinterName" Value="TM-H6000II" />
  <Property Name="PortInterfaceName" Value="Wireless" />
  <Property Name="PortName" Value="10.65.77.176" />
  <Property Name="PortType" Value="5" />
  <Property Name="preEndorseFunction" Value="0" />
  <Property Name="PrinterTransmitTimeout" Value="30000" />
  <Property Name="QueuingOfflineTimeout" Value="1000" />
  <Property Name="ReadThreadInterval" Value="-1" />
  <Property Name="ReceiveRetryTime" Value="25" />
  <Property Name="ReceiveTimeout" Value="1000" />
  <Property Name="RecMoreColumns" Value="0" />
  <Property Name="RecNearEndSensor" Value="1" />
  <Property Name="RecPaperSize" Value="80" />
  <Property Name="RecPaperType" Value="0" />
  <Property Name="SlpMoreColumns" Value="0" />
  <Property Name="SlpReverseEject" Value="0" />
  <Property Name="Stamp" Value="0" />
  <Property Name="StatusThreadInterval" Value="500" />
  <Property Name="SupportFirmware" Value="0" />
  <Property Name="SupportStatistics" Value="1" />
  <Property Name="TcpPort" Value="9100" />
  <Property Name="TransmitRetryTime" Value="100" />
  <Property Name="TransmitTimeout" Value="5000" />
  <Property Name="TwoByteCharacter" Value="0" />
  <Property Name="TwoColor" Value="0" />
  <Property Name="U375Compatible" Value="0" />
  <Property Name="UdpPort" Value="3289" />
  <Property Name="UdpReceiveTimeout" Value="1000" />
  <Property Name="UdpRetryCount" Value="2" />
  <Property Name="UdpRetryIntervalTime" Value="50" />
  <Property Name="UdpTransmitTimeout" Value="1000" />
  <Property Name="Upos.Spec_c" Value="false" />
  <Property Name="Upos.USB_Serial" Value="false" />
  <Property Name="UsedInterCharacterSet" Value="0" />
  <Property Name="UsedNVRAM" Value="1" />
  <Property Name="UsedPeeler" Value="0" />
  <Property Name="WriteThreadInterval" Value="-1" />
</Device>
<Device HardwarePath="10.65.77.177">
  <LogicalName Name="C10177" />
  <Property Name="AsyncProcessingSize" Value="2" />
  <Property Name="AutoPowerOff" Value="-1" />
  <Property Name="ConfigurationFile" Value="epson/xml/Setting/TM-H6000IISetting.xml" />
  <Property Name="CoreVersion" Value="1.12.0001" />
  <Property Name="Custom1Color" Value="0xFF0000" />
  <Property Name="Cutter" Value="1" />
  <Property Name="DefaultCodePage" Value="997" />
  <Property Name="DefaultSlpClampTime" Value="0" />
  <Property Name="DeviceDesc" Value="EPSON TM-H6000II POSPrinter" />
  <Property Name="DeviceID" Value="36" />
  <Property Name="DeviceType" Value="1" />
  <Property Name="DirectIOEventTimeout" Value="5000" />
  <Property Name="epson.trace.file" Value="trace.log" />
  <Property Name="epson.trace.max.size" Value="1000" />
  <Property Name="epson.tracing" Value="false" />
  <Property Name="EPurasSupport" Value="TRUE" />
  <Property Name="FirmLogFileName" Value="Firmware.log" />
  <Property Name="FirmLogFileSize" Value="1000" />
  <Property Name="FirmNotifyAllProgressEvents" Value="0" />
  <Property Name="FirmProgressRange" Value="10" />
  <Property Name="FirmRecordLog" Value="1" />
  <Property Name="Halftone" Value="0" />
  <Property Name="InitializeResponseTimeout" Value="5000" />
  <Property Name="InitializeThreadTime" Value="1000" />
  <Property Name="InputBufferSize" Value="4096" />
  <Property Name="InputTimeout" Value="1000" />
  <Property Name="KanjiTwoWaysPrint" Value="0" />
  <Property Name="LogicalName" Value="C10177" />
  <Property Name="LogicalPortInterfaceName" Value="EPuras" />
  <Property Name="LogicalPortName" Value="ESDPRT002" />
  <Property Name="LogObject" Value="" />
  <Property Name="MemorySwitch" Value="0" />
  <Property Name="NVRAMControlLevel" Value="1" />
  <Property Name="OfflineCount" Value="1" />
  <Property Name="OfflineRetryIntervalTime" Value="100" />
  <Property Name="OutputBufferSize" Value="32768" />
  <Property Name="OutputCompleteType" Value="2" />
  <Property Name="OutputErrorOption" Value="0" />
  <Property Name="OutputTimeout" Value="2000" />
  <Property Name="PageModeExt" Value="0" />
  <Property Name="Peeler" Value="0" />
  <Property Name="PhysicalDevice" Value="TM-H6000II" />
  <Property Name="PhysicalPrinterName" Value="TM-H6000II" />
  <Property Name="PortInterfaceName" Value="Wireless" />
  <Property Name="PortName" Value="10.65.77.177" />
  <Property Name="PortType" Value="5" />
  <Property Name="preEndorseFunction" Value="0" />
  <Property Name="PrinterTransmitTimeout" Value="30000" />
  <Property Name="QueuingOfflineTimeout" Value="1000" />
  <Property Name="ReadThreadInterval" Value="-1" />
  <Property Name="ReceiveRetryTime" Value="25" />
  <Property Name="ReceiveTimeout" Value="1000" />
  <Property Name="RecMoreColumns" Value="0" />
  <Property Name="RecNearEndSensor" Value="1" />
  <Property Name="RecPaperSize" Value="80" />
  <Property Name="RecPaperType" Value="0" />
  <Property Name="SlpMoreColumns" Value="0" />
  <Property Name="SlpReverseEject" Value="0" />
  <Property Name="Stamp" Value="0" />
  <Property Name="StatusThreadInterval" Value="500" />
  <Property Name="SupportFirmware" Value="0" />
  <Property Name="SupportStatistics" Value="1" />
  <Property Name="TcpPort" Value="9100" />
  <Property Name="TransmitRetryTime" Value="100" />
  <Property Name="TransmitTimeout" Value="5000" />
  <Property Name="TwoByteCharacter" Value="0" />
  <Property Name="TwoColor" Value="0" />
  <Property Name="U375Compatible" Value="0" />
  <Property Name="UdpPort" Value="3289" />
  <Property Name="UdpReceiveTimeout" Value="1000" />
  <Property Name="UdpRetryCount" Value="2" />
  <Property Name="UdpRetryIntervalTime" Value="50" />
  <Property Name="UdpTransmitTimeout" Value="1000" />
  <Property Name="Upos.Spec_c" Value="false" />
  <Property Name="Upos.USB_Serial" Value="false" />
  <Property Name="UsedInterCharacterSet" Value="0" />
  <Property Name="UsedNVRAM" Value="1" />
  <Property Name="UsedPeeler" Value="0" />
  <Property Name="WriteThreadInterval" Value="-1" />
</Device>
<Device HardwarePath="10.65.77.178">
  <LogicalName Name="C10178" />
  <Property Name="AsyncProcessingSize" Value="2" />
  <Property Name="AutoPowerOff" Value="-1" />
  <Property Name="ConfigurationFile" Value="epson/xml/Setting/TM-H6000IISetting.xml" />
  <Property Name="CoreVersion" Value="1.12.0001" />
  <Property Name="Custom1Color" Value="0xFF0000" />
  <Property Name="Cutter" Value="1" />
  <Property Name="DefaultCodePage" Value="997" />
  <Property Name="DefaultSlpClampTime" Value="0" />
  <Property Name="DeviceDesc" Value="EPSON TM-H6000II POSPrinter" />
  <Property Name="DeviceID" Value="36" />
  <Property Name="DeviceType" Value="1" />
  <Property Name="DirectIOEventTimeout" Value="5000" />
  <Property Name="epson.trace.file" Value="trace.log" />
  <Property Name="epson.trace.max.size" Value="1000" />
  <Property Name="epson.tracing" Value="false" />
  <Property Name="EPurasSupport" Value="TRUE" />
  <Property Name="FirmLogFileName" Value="Firmware.log" />
  <Property Name="FirmLogFileSize" Value="1000" />
  <Property Name="FirmNotifyAllProgressEvents" Value="0" />
  <Property Name="FirmProgressRange" Value="10" />
  <Property Name="FirmRecordLog" Value="1" />
  <Property Name="Halftone" Value="0" />
  <Property Name="InitializeResponseTimeout" Value="5000" />
  <Property Name="InitializeThreadTime" Value="1000" />
  <Property Name="InputBufferSize" Value="4096" />
  <Property Name="InputTimeout" Value="1000" />
  <Property Name="KanjiTwoWaysPrint" Value="0" />
  <Property Name="LogicalName" Value="C10178" />
  <Property Name="LogicalPortInterfaceName" Value="EPuras" />
  <Property Name="LogicalPortName" Value="ESDPRT003" />
  <Property Name="LogObject" Value="" />
  <Property Name="MemorySwitch" Value="0" />
  <Property Name="NVRAMControlLevel" Value="1" />
  <Property Name="OfflineCount" Value="1" />
  <Property Name="OfflineRetryIntervalTime" Value="100" />
  <Property Name="OutputBufferSize" Value="32768" />
  <Property Name="OutputCompleteType" Value="2" />
  <Property Name="OutputErrorOption" Value="0" />
  <Property Name="OutputTimeout" Value="2000" />
  <Property Name="PageModeExt" Value="0" />
  <Property Name="Peeler" Value="0" />
  <Property Name="PhysicalDevice" Value="TM-H6000II" />
  <Property Name="PhysicalPrinterName" Value="TM-H6000II" />
  <Property Name="PortInterfaceName" Value="Wireless" />
  <Property Name="PortName" Value="10.65.77.178" />
  <Property Name="PortType" Value="5" />
  <Property Name="preEndorseFunction" Value="0" />
  <Property Name="PrinterTransmitTimeout" Value="30000" />
  <Property Name="QueuingOfflineTimeout" Value="1000" />
  <Property Name="ReadThreadInterval" Value="-1" />
  <Property Name="ReceiveRetryTime" Value="25" />
  <Property Name="ReceiveTimeout" Value="1000" />
  <Property Name="RecMoreColumns" Value="0" />
  <Property Name="RecNearEndSensor" Value="1" />
  <Property Name="RecPaperSize" Value="80" />
  <Property Name="RecPaperType" Value="0" />
  <Property Name="SlpMoreColumns" Value="0" />
  <Property Name="SlpReverseEject" Value="0" />
  <Property Name="Stamp" Value="0" />
  <Property Name="StatusThreadInterval" Value="500" />
  <Property Name="SupportFirmware" Value="0" />
  <Property Name="SupportStatistics" Value="1" />
  <Property Name="TcpPort" Value="9100" />
  <Property Name="TransmitRetryTime" Value="100" />
  <Property Name="TransmitTimeout" Value="5000" />
  <Property Name="TwoByteCharacter" Value="0" />
  <Property Name="TwoColor" Value="0" />
  <Property Name="U375Compatible" Value="0" />
  <Property Name="UdpPort" Value="3289" />
  <Property Name="UdpReceiveTimeout" Value="1000" />
  <Property Name="UdpRetryCount" Value="2" />
  <Property Name="UdpRetryIntervalTime" Value="50" />
  <Property Name="UdpTransmitTimeout" Value="1000" />
  <Property Name="Upos.Spec_c" Value="false" />
  <Property Name="Upos.USB_Serial" Value="false" />
  <Property Name="UsedInterCharacterSet" Value="0" />
  <Property Name="UsedNVRAM" Value="1" />
  <Property Name="UsedPeeler" Value="0" />
  <Property Name="WriteThreadInterval" Value="-1" />
</Device>
<Device HardwarePath="10.65.77.179">
  <LogicalName Name="C10179" />
  <Property Name="AsyncProcessingSize" Value="2" />
  <Property Name="AutoPowerOff" Value="-1" />
  <Property Name="ConfigurationFile" Value="epson/xml/Setting/TM-H6000IISetting.xml" />
  <Property Name="CoreVersion" Value="1.12.0001" />
  <Property Name="Custom1Color" Value="0xFF0000" />
  <Property Name="Cutter" Value="1" />
  <Property Name="DefaultCodePage" Value="997" />
  <Property Name="DefaultSlpClampTime" Value="0" />
  <Property Name="DeviceDesc" Value="EPSON TM-H6000II POSPrinter" />
  <Property Name="DeviceID" Value="36" />
  <Property Name="DeviceType" Value="1" />
  <Property Name="DirectIOEventTimeout" Value="5000" />
  <Property Name="epson.trace.file" Value="trace.log" />
  <Property Name="epson.trace.max.size" Value="1000" />
  <Property Name="epson.tracing" Value="false" />
  <Property Name="EPurasSupport" Value="TRUE" />
  <Property Name="FirmLogFileName" Value="Firmware.log" />
  <Property Name="FirmLogFileSize" Value="1000" />
  <Property Name="FirmNotifyAllProgressEvents" Value="0" />
  <Property Name="FirmProgressRange" Value="10" />
  <Property Name="FirmRecordLog" Value="1" />
  <Property Name="Halftone" Value="0" />
  <Property Name="InitializeResponseTimeout" Value="5000" />
  <Property Name="InitializeThreadTime" Value="1000" />
  <Property Name="InputBufferSize" Value="4096" />
  <Property Name="InputTimeout" Value="1000" />
  <Property Name="KanjiTwoWaysPrint" Value="0" />
  <Property Name="LogicalName" Value="C10179" />
  <Property Name="LogicalPortInterfaceName" Value="EPuras" />
  <Property Name="LogicalPortName" Value="ESDPRT004" />
  <Property Name="LogObject" Value="" />
  <Property Name="MemorySwitch" Value="0" />
  <Property Name="NVRAMControlLevel" Value="1" />
  <Property Name="OfflineCount" Value="1" />
  <Property Name="OfflineRetryIntervalTime" Value="100" />
  <Property Name="OutputBufferSize" Value="32768" />
  <Property Name="OutputCompleteType" Value="2" />
  <Property Name="OutputErrorOption" Value="0" />
  <Property Name="OutputTimeout" Value="2000" />
  <Property Name="PageModeExt" Value="0" />
  <Property Name="Peeler" Value="0" />
  <Property Name="PhysicalDevice" Value="TM-H6000II" />
  <Property Name="PhysicalPrinterName" Value="TM-H6000II" />
  <Property Name="PortInterfaceName" Value="Wireless" />
  <Property Name="PortName" Value="10.65.77.179" />
  <Property Name="PortType" Value="5" />
  <Property Name="preEndorseFunction" Value="0" />
  <Property Name="PrinterTransmitTimeout" Value="30000" />
  <Property Name="QueuingOfflineTimeout" Value="1000" />
  <Property Name="ReadThreadInterval" Value="-1" />
  <Property Name="ReceiveRetryTime" Value="25" />
  <Property Name="ReceiveTimeout" Value="1000" />
  <Property Name="RecMoreColumns" Value="0" />
  <Property Name="RecNearEndSensor" Value="1" />
  <Property Name="RecPaperSize" Value="80" />
  <Property Name="RecPaperType" Value="0" />
  <Property Name="SlpMoreColumns" Value="0" />
  <Property Name="SlpReverseEject" Value="0" />
  <Property Name="Stamp" Value="0" />
  <Property Name="StatusThreadInterval" Value="500" />
  <Property Name="SupportFirmware" Value="0" />
  <Property Name="SupportStatistics" Value="1" />
  <Property Name="TcpPort" Value="9100" />
  <Property Name="TransmitRetryTime" Value="100" />
  <Property Name="TransmitTimeout" Value="5000" />
  <Property Name="TwoByteCharacter" Value="0" />
  <Property Name="TwoColor" Value="0" />
  <Property Name="U375Compatible" Value="0" />
  <Property Name="UdpPort" Value="3289" />
  <Property Name="UdpReceiveTimeout" Value="1000" />
  <Property Name="UdpRetryCount" Value="2" />
  <Property Name="UdpRetryIntervalTime" Value="50" />
  <Property Name="UdpTransmitTimeout" Value="1000" />
  <Property Name="Upos.Spec_c" Value="false" />
  <Property Name="Upos.USB_Serial" Value="false" />
  <Property Name="UsedInterCharacterSet" Value="0" />
  <Property Name="UsedNVRAM" Value="1" />
  <Property Name="UsedPeeler" Value="0" />
  <Property Name="WriteThreadInterval" Value="-1" />
</Device>
<Device HardwarePath="10.65.77.180">
  <LogicalName Name="C10180" />
  <Property Name="AsyncProcessingSize" Value="2" />
  <Property Name="AutoPowerOff" Value="-1" />
  <Property Name="ConfigurationFile" Value="epson/xml/Setting/TM-H6000IISetting.xml" />
  <Property Name="CoreVersion" Value="1.12.0001" />
  <Property Name="Custom1Color" Value="0xFF0000" />
  <Property Name="Cutter" Value="1" />
  <Property Name="DefaultCodePage" Value="997" />
  <Property Name="DefaultSlpClampTime" Value="0" />
  <Property Name="DeviceDesc" Value="EPSON TM-H6000II POSPrinter" />
  <Property Name="DeviceID" Value="36" />
  <Property Name="DeviceType" Value="1" />
  <Property Name="DirectIOEventTimeout" Value="5000" />
  <Property Name="epson.trace.file" Value="trace.log" />
  <Property Name="epson.trace.max.size" Value="1000" />
  <Property Name="epson.tracing" Value="false" />
  <Property Name="EPurasSupport" Value="TRUE" />
  <Property Name="FirmLogFileName" Value="Firmware.log" />
  <Property Name="FirmLogFileSize" Value="1000" />
  <Property Name="FirmNotifyAllProgressEvents" Value="0" />
  <Property Name="FirmProgressRange" Value="10" />
  <Property Name="FirmRecordLog" Value="1" />
  <Property Name="Halftone" Value="0" />
  <Property Name="InitializeResponseTimeout" Value="5000" />
  <Property Name="InitializeThreadTime" Value="1000" />
  <Property Name="InputBufferSize" Value="4096" />
  <Property Name="InputTimeout" Value="1000" />
  <Property Name="KanjiTwoWaysPrint" Value="0" />
  <Property Name="LogicalName" Value="C10180" />
  <Property Name="LogicalPortInterfaceName" Value="EPuras" />
  <Property Name="LogicalPortName" Value="ESDPRT005" />
  <Property Name="LogObject" Value="" />
  <Property Name="MemorySwitch" Value="0" />
  <Property Name="NVRAMControlLevel" Value="1" />
  <Property Name="OfflineCount" Value="1" />
  <Property Name="OfflineRetryIntervalTime" Value="100" />
  <Property Name="OutputBufferSize" Value="32768" />
  <Property Name="OutputCompleteType" Value="2" />
  <Property Name="OutputErrorOption" Value="0" />
  <Property Name="OutputTimeout" Value="2000" />
  <Property Name="PageModeExt" Value="0" />
  <Property Name="Peeler" Value="0" />
  <Property Name="PhysicalDevice" Value="TM-H6000II" />
  <Property Name="PhysicalPrinterName" Value="TM-H6000II" />
  <Property Name="PortInterfaceName" Value="Wireless" />
  <Property Name="PortName" Value="10.65.77.180" />
  <Property Name="PortType" Value="5" />
  <Property Name="preEndorseFunction" Value="0" />
  <Property Name="PrinterTransmitTimeout" Value="30000" />
  <Property Name="QueuingOfflineTimeout" Value="1000" />
  <Property Name="ReadThreadInterval" Value="-1" />
  <Property Name="ReceiveRetryTime" Value="25" />
  <Property Name="ReceiveTimeout" Value="1000" />
  <Property Name="RecMoreColumns" Value="0" />
  <Property Name="RecNearEndSensor" Value="1" />
  <Property Name="RecPaperSize" Value="80" />
  <Property Name="RecPaperType" Value="0" />
  <Property Name="SlpMoreColumns" Value="0" />
  <Property Name="SlpReverseEject" Value="0" />
  <Property Name="Stamp" Value="0" />
  <Property Name="StatusThreadInterval" Value="500" />
  <Property Name="SupportFirmware" Value="0" />
  <Property Name="SupportStatistics" Value="1" />
  <Property Name="TcpPort" Value="9100" />
  <Property Name="TransmitRetryTime" Value="100" />
  <Property Name="TransmitTimeout" Value="5000" />
  <Property Name="TwoByteCharacter" Value="0" />
  <Property Name="TwoColor" Value="0" />
  <Property Name="U375Compatible" Value="0" />
  <Property Name="UdpPort" Value="3289" />
  <Property Name="UdpReceiveTimeout" Value="1000" />
  <Property Name="UdpRetryCount" Value="2" />
  <Property Name="UdpRetryIntervalTime" Value="50" />
  <Property Name="UdpTransmitTimeout" Value="1000" />
  <Property Name="Upos.Spec_c" Value="false" />
  <Property Name="Upos.USB_Serial" Value="false" />
  <Property Name="UsedInterCharacterSet" Value="0" />
  <Property Name="UsedNVRAM" Value="1" />
  <Property Name="UsedPeeler" Value="0" />
  <Property Name="WriteThreadInterval" Value="-1" />
</Device>
<Device HardwarePath="10.65.77.181">
  <LogicalName Name="C10181" />
  <Property Name="AsyncProcessingSize" Value="2" />
  <Property Name="AutoPowerOff" Value="-1" />
  <Property Name="ConfigurationFile" Value="epson/xml/Setting/TM-H6000IISetting.xml" />
  <Property Name="CoreVersion" Value="1.12.0001" />
  <Property Name="Custom1Color" Value="0xFF0000" />
  <Property Name="Cutter" Value="1" />
  <Property Name="DefaultCodePage" Value="997" />
  <Property Name="DefaultSlpClampTime" Value="0" />
  <Property Name="DeviceDesc" Value="EPSON TM-H6000II POSPrinter" />
  <Property Name="DeviceID" Value="36" />
  <Property Name="DeviceType" Value="1" />
  <Property Name="DirectIOEventTimeout" Value="5000" />
  <Property Name="epson.trace.file" Value="trace.log" />
  <Property Name="epson.trace.max.size" Value="1000" />
  <Property Name="epson.tracing" Value="false" />
  <Property Name="EPurasSupport" Value="TRUE" />
  <Property Name="FirmLogFileName" Value="Firmware.log" />
  <Property Name="FirmLogFileSize" Value="1000" />
  <Property Name="FirmNotifyAllProgressEvents" Value="0" />
  <Property Name="FirmProgressRange" Value="10" />
  <Property Name="FirmRecordLog" Value="1" />
  <Property Name="Halftone" Value="0" />
  <Property Name="InitializeResponseTimeout" Value="5000" />
  <Property Name="InitializeThreadTime" Value="1000" />
  <Property Name="InputBufferSize" Value="4096" />
  <Property Name="InputTimeout" Value="1000" />
  <Property Name="KanjiTwoWaysPrint" Value="0" />
  <Property Name="LogicalName" Value="C10181" />
  <Property Name="LogicalPortInterfaceName" Value="EPuras" />
  <Property Name="LogicalPortName" Value="ESDPRT006" />
  <Property Name="LogObject" Value="" />
  <Property Name="MemorySwitch" Value="0" />
  <Property Name="NVRAMControlLevel" Value="1" />
  <Property Name="OfflineCount" Value="1" />
  <Property Name="OfflineRetryIntervalTime" Value="100" />
  <Property Name="OutputBufferSize" Value="32768" />
  <Property Name="OutputCompleteType" Value="2" />
  <Property Name="OutputErrorOption" Value="0" />
  <Property Name="OutputTimeout" Value="2000" />
  <Property Name="PageModeExt" Value="0" />
  <Property Name="Peeler" Value="0" />
  <Property Name="PhysicalDevice" Value="TM-H6000II" />
  <Property Name="PhysicalPrinterName" Value="TM-H6000II" />
  <Property Name="PortInterfaceName" Value="Wireless" />
  <Property Name="PortName" Value="10.65.77.181" />
  <Property Name="PortType" Value="5" />
  <Property Name="preEndorseFunction" Value="0" />
  <Property Name="PrinterTransmitTimeout" Value="30000" />
  <Property Name="QueuingOfflineTimeout" Value="1000" />
  <Property Name="ReadThreadInterval" Value="-1" />
  <Property Name="ReceiveRetryTime" Value="25" />
  <Property Name="ReceiveTimeout" Value="1000" />
  <Property Name="RecMoreColumns" Value="0" />
  <Property Name="RecNearEndSensor" Value="1" />
  <Property Name="RecPaperSize" Value="80" />
  <Property Name="RecPaperType" Value="0" />
  <Property Name="SlpMoreColumns" Value="0" />
  <Property Name="SlpReverseEject" Value="0" />
  <Property Name="Stamp" Value="0" />
  <Property Name="StatusThreadInterval" Value="500" />
  <Property Name="SupportFirmware" Value="0" />
  <Property Name="SupportStatistics" Value="1" />
  <Property Name="TcpPort" Value="9100" />
  <Property Name="TransmitRetryTime" Value="100" />
  <Property Name="TransmitTimeout" Value="5000" />
  <Property Name="TwoByteCharacter" Value="0" />
  <Property Name="TwoColor" Value="0" />
  <Property Name="U375Compatible" Value="0" />
  <Property Name="UdpPort" Value="3289" />
  <Property Name="UdpReceiveTimeout" Value="1000" />
  <Property Name="UdpRetryCount" Value="2" />
  <Property Name="UdpRetryIntervalTime" Value="50" />
  <Property Name="UdpTransmitTimeout" Value="1000" />
  <Property Name="Upos.Spec_c" Value="false" />
  <Property Name="Upos.USB_Serial" Value="false" />
  <Property Name="UsedInterCharacterSet" Value="0" />
  <Property Name="UsedNVRAM" Value="1" />
  <Property Name="UsedPeeler" Value="0" />
  <Property Name="WriteThreadInterval" Value="-1" />
</Device>
</ServiceObject>
</PointOfServiceConfig>

1 个答案:

答案 0 :(得分:1)

试试这个:)

 [xml]$XmlDocument = Get-Content -Path C:\temp\root\client1\test.xml
 $XmlDocument.selectNodes('//PointOfServiceConfig/ServiceObject/Device') | foreach{ New-Object -TypeName psobject -Property @{HardwarePath=$_.HardwarePath; LogicalName=$_.LogicalName.Name} }