读取xml格式文件

$v = [xml]get-content d:vmconfig.xml

$v.Domain.Computer.Name

 ===========================

$v.GetElementsByTagName("CPUCount")  #此处区分大小写

vmconfig.xml内容:

<?xml version="1.0" encoding="UTF-8"?>
<Domain>
<Computer>
<Name>stcmm-vm-s01</Name>
<IpAddress>192.168.0.2</IpAddress>
<CPUCount>4</CPUCount>
<Memory>4096</Memory>
</Computer>
</Domain>

原文地址:https://www.cnblogs.com/dreamer-fish/p/3756020.html