[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

powershell write-xml line

Posted on 2013-11-20
1
Medium Priority
?
755 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

Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
Loops Section Overview
Screencast - Getting to Know the Pipeline

873 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