オブジェクトをXMLに変換するには、ConvertTo-Xmlを使います。
例
PS C:\work\image1> Get-ChildItem | Select-Object Name, LastWriteTime, Length | ConvertTo-Xml -As String <?xml version="1.0" encoding="utf-8"?> <Objects> <Object Type="System.Management.Automation.PSCustomObject"> <Property Name="Name" Type="System.String">aaaa.jpg</Property> <Property Name="LastWriteTime" Type="System.DateTime">2016/10/15 0:20:20</Property> <Property Name="Length" Type="System.Int64">425167</Property> </Object> <Object Type="System.Management.Automation.PSCustomObject"> <Property Name="Name" Type="System.String">bbbb.jpg</Property> <Property Name="LastWriteTime" Type="System.DateTime">2016/10/10 10:14:04</Property> <Property Name="Length" Type="System.Int64">245901</Property> </Object> <Object Type="System.Management.Automation.PSCustomObject"> <Property Name="Name" Type="System.String">cccc.jpg</Property> <Property Name="LastWriteTime" Type="System.DateTime">2016/10/10 10:05:19</Property> <Property Name="Length" Type="System.Int64">194315</Property> </Object> <Object Type="System.Management.Automation.PSCustomObject"> <Property Name="Name" Type="System.String">dddd.jpg</Property> <Property Name="LastWriteTime" Type="System.DateTime">2016/10/10 10:13:35</Property> <Property Name="Length" Type="System.Int64">235320</Property> </Object> <Object Type="System.Management.Automation.PSCustomObject"> <Property Name="Name" Type="System.String">eeee.jpg</Property> <Property Name="LastWriteTime" Type="System.DateTime">2016/10/15 0:19:45</Property> <Property Name="Length" Type="System.Int64">852563</Property> </Object> <Object Type="System.Management.Automation.PSCustomObject"> <Property Name="Name" Type="System.String">ffff.jpg</Property> <Property Name="LastWriteTime" Type="System.DateTime">2016/10/15 19:06:09</Property> <Property Name="Length" Type="System.Int64">593126</Property> </Object> <Object Type="System.Management.Automation.PSCustomObject"> <Property Name="Name" Type="System.String">gggg.jpg</Property> <Property Name="LastWriteTime" Type="System.DateTime">2016/10/15 0:21:41</Property> <Property Name="Length" Type="System.Int64">607218</Property> </Object> </Objects>
スポンサーリンク