I am trying to write a Script to easily customize my MDT Server / Deployment in the future.
$xml = New-Object System.Xml.XmlDocument
$xml.Load($filePath)
$xml.unattend.settings.component.UserData.FullName = "MYUSER"
$xml.unattend.settings.component.UserAccounts.AdministratorPassword.Value = "Password"
Write-Verbose $xml.OuterXml
$xml.Save($filePath)
This is the code I have scrapped together this far. I am using the Sample XML file from https://virtualfeller.com/unattend-xml-windows-10/ to debug.
The AdministratorPassword>Value node is being changed no problem but the FullName node throws me a "Object cannot be found error".
Interestingly if I use a copy of the XML used in Production neither nodes can get found even tho the "paths" are the same.
I am quite new to Powershell scripting so I'm unsure if or how to use the path expressions explained here https://www.w3schools.com/xml/xpath_syntax.asp
I have tried Indexing settings and component like described here here, sadly without success.
Thank you in advance for any help