Solved

powershell write-xml line

Posted on 2013-11-20
1
696 Views
Last Modified: 2013-11-20
I have to recreate an xml file to import into a program.  The line I am having problems recreating looks like this
<Type xmlns="http://www.microsoft.com/provisioning/EapCommon">11</Type>

I can write the element type and add the xmlns attrbuite but I don't know how to add the value and then close the element.  The closes I have gotten is

<Type xmlns="http://www.microsoft.com/provisioning/EapCommon"/>

using this code
$xmlWriter.WriteElementString('Type')                                    $XmlWriter.WriteAttributeString('xmlns',"http://www.microsoft.com/provisioning/EapCommon")

What do I need to do to get the lines to match

Thanks

Dan
0
Comment
Question by:DanDWolff
1 Comment
 

Accepted Solution

by:
DanDWolff earned 0 total points
ID: 39663096
Figured it out, thought I would post the code in case anybody else runs into this problem

$XmlWriter.WriteStartElement("Type")
$XmlWriter.WriteAttributeString('xmlns',"http://www.microsoft.com/provisioning/EapCommon")
$XmlWriter.WriteString("25")
$XmlWriter.WriteEndElement()

Open in new window

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Set OWA language and time zone in Exchange for individuals, all users or per database.
Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now