Scripting Question

Powershell Help to edit XML file

09/09/2020 112 views

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


All Answers



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
Answered 09/10/2020 by: rileyz
Red Belt

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