$v = [xml]get-content d:\vmconfig.xml
$v.Domain.Computer.Name
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>
原文地址:http://www.cnblogs.com/dreamer-fish/p/3756020.html