Powershell Help to edit XML file

New at this, and would like some help to edit a .xml file with Powershell. The XML file is located locally on a workstation. I'm trying to change the AuthenticationType to "Kerberos"  Everything I've tried runs with no errors but does not change the value. Any help would be greatly appreciated.


0 Comments   [ + ] Show comments

Answers (1)

Posted by: rileyz 8 months ago
Red Belt


Its not the best code I have written, but also not the worst - but most importantly it does what says on the tin ✌

$XML = "C:\Media\Test.txt"
$XMLContent = Get-Content "C:\Media\Test.txt"
Rename-Item -Path $XML -NewName ($XML + '.Backup')
$XMLContent = $XMLContent -replace 'authenticationType="Basic"','authenticationType="Kerberos"'
$XMLContent | Out-File $XML

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ