I am using the PowerShell module to fetch a component via core service. My end goal is to update it and save it. however, I am failing to get started on the XML parsing aspect of things. So, this part is easy

$tridionItem = Get-TridionItem -Id "/webdav/C020%20Shared%20Global%20Content%20US%20English/Building%20Blocks/System/Content/Administration/Workflow/Workflow%20Configuration.xml"
$tridionItemContentXML = $tridionItem.Content
$xdoc = ConvertTo-Xml -InputObject $tridionItemContentXML

I exported the item XML to a file (shown below). So, then I tried both of these approaches. According to my XML tool, the XPath is valid. however... it may indeed be lying.

$test1 = Select-Xml -XPath "/*[local-name()='system_values']" -Xml $xdoc
$test1 = $xdoc.SelectNodes('/*[local-name()="system_values"]')

Both return null. So, I tried messing around with XMLNS but that hasn't changed things.

$ns = @{sv="http://www.mycompany.com/tridion/schema/system_values"}
$test1 = Select-Xml -XPath '/sv:system_values' -Xml $xdoc -Namespace $ns

Here's the item XML.

<system_values xmlns="http://www.mycompany.com/tridion/schema/system_values"><system_values><name>EmailFolder</name><value>/webdav/C020%20Shared%20Global%20Content%20US%20English/Building%20Blocks/System/Content/Administration/Workflow/Email</value></system_values><system_values><name>SMTPServer</name><value>server.mycompany.com</value></system_values><system_values><name>SMTPPort</name><value>25</value></system_values><system_values><name>SMTPUser</name></system_values><system_values><name>SMTPPassword</name></system_values><system_values><name>SMTPSSLEnabled</name><value>false</value></system_values><system_values><name>SMTPIsBodyHTML</name><value>true</value></system_values><system_values><name>EmailFrom</name><value>Tridion Workflow Agent &lt;[email protected]&gt;</value></system_values><system_values><name>ContentManagerURL</name><value>https://server.mycompany.com:12301</value></system_values><system_values><name>CoreServiceEndPoint</name><value>net.tcp://localhost:2660/CoreService/netTcp_2010</value></system_values><system_values><name>PublishValidationTimedOutHours</name><value>72</value></system_values><system_values><name>EmailSwitch</name><value>ON</value></system_values></system_values>

1 Answer 1


I don't recognise Convert-To-Xml as a standard Powershell function, although maybe it's in a module you are using. In any case, to get the content into an XML document all you need to do is:

$xDoc = [xml]$tridionItem.Content

If Convert-To-Xml isn't working, Select-Xml will silently return null - you can test this simply like this:

PS C:\Users\Administrator> (select-xml -XPath "/*" -xml ([xml]"")) -eq $null
  • ConvertTo-XML is available in PS 2.0. But, I guess it's doing something very different... so, indeed I just needed to cast it to XML. I think it's working now. much appreciated. Apr 30, 2014 at 15:54
  • I see now - it's ConvertTo-Xml - I had an extra hyphen. The docs say that it will convert a .net object to xml - so now what you needed. Apr 30, 2014 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.