![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | writing output to XML file I have a log file and I have convert it into a xml file. Log file : ====================================== Machine Details Computer Name : ABCD-101 UserName : test Domain : WORKGROUP IP Address : xxx.xx.xx.xx OS : Microsoft Windows XP Professional - Service Pack 2 .... Product Information Product : XYZ Version : 1.0.1 InstallDate : 20061222 .... ====================================== And I want to convert it to xml file with following format, ====================================== <?xml version="1.0" ?> <MyXml> <MachineDetails> <ComputerName>ABCD-101</ComputerName> <UserName>test</UserName> <Domain>WORKGROUP</Domain> <IP Address >xxx.xx.xx.xx</IP Address > <OS>Microsoft Windows XP Professional - Service Pack 2</OS> </MachineDetails> <ProductInfo> <Product>XYZ</Product> <Version>1.0.1</Version> <InstallDate >20061222</InstallDate > </ProductInfo> </MyXml> ====================================== The one way I can think of is to use use Get-Content to get all the data from log file and use SPLIT to split the line with ":" as separator. Then compose a line using tags and data & use OUT-FILE to write to a file. Is there any better way to create a XML file? |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem Writing file to CD | cjamps | .NET General | 1 | 08-18-2008 10:26 PM |
| writing out to file | Braden C. Roberson-Mailloux | PowerShell | 3 | 05-18-2008 01:12 PM |
| Re: Writing output to a formatted file | Keith Hill [MVP] | PowerShell | 0 | 11-08-2007 08:49 PM |
| Writing to host in functions and cmdlets - how to capture this output | Keith Hill [MVP] | PowerShell | 1 | 12-30-2006 03:54 PM |
| Writing to a file with out-file or export-csv | Marco Shaw | PowerShell | 1 | 11-07-2006 02:44 PM |