0

我试图将子节点()添加到 reportserver.config 文件,但我得到了一个错误,我实际上不知道经过所有努力。下面是我所做的。

$webConfigPath = "C:\Program Files\Microsoft SQL Server\MSRS10_50.SNDPRO\Reporting Services\ReportServer\rsreportserver.config"

$xml =[xml] (获取内容 $webConfigPath)

$child = $xml.CreateElement("RSWindowsNegotiate")

$xml.Configuration.Authentication.AuthenticationTypes.InsertBefore($child, "$xml.Configuration.Authentication.AuthenticationTypes.RSWindowsNTLM")

$xml.Save($webConfigPath)

错误是:无法将参数“1”,值:“”转换为“InsertBefore”以键入“System.Xml.XmlNode”:“无法将“”类型的“System.String”值转换为“System” .Xml.XmlNode"。"

非常感谢您的帮助。

4

1 回答 1

1

我认为当使用空的 XML 元素作为属性(在本例中为 RSWindowsNTLM)时,powershell 会做一些奇怪的事情。尝试这个:

$RSWindowsNTLM = $xml.Configuration.Authentication.AuthenticationTypes.SelectSingleNode("RSWindowsNTLM");
$xml.Configuration.Authentication.AuthenticationTypes.InsertBefore($child, $RSWindowsNTLM)
于 2012-08-23T14:06:02.353 回答