已答复 Problems updating an XML file

  • 2012年7月26日 19:20
     
     

    Hi,

    I have written a function to up date the PID Key in a config.xml file.

    This is used by SharePoint during a silent install.

    It works, however it is adding some additional charactors at the end of the PID that cause the install to quit.

    to wit: 


    I beleve these are white spaces and carage returns. How do I write my update to keep tis from happening?

    Function UpdateXML{
    $drv = "E"
    $PIDKey = $txtBoxPID.Text
    $PIDKey = $PIDKey.ToString()
    $statusbar2.Text = "$PIDKey"
    $xfile = "E:\SP2010_DoNotDelete\Scripts\config.xml"
    $xmlData = [xml](gc $xFile)
    $statusbar2.Text = "Updating config.xml"
    $xmlData.Configuration.PIDKEY.Value = $PIDKey
    $xmlData.Save($xFile)
    $statusbar1.Text = "config.xml Updated"
       }



    • 已编辑 OldDog1 2012年7月26日 19:20 spelling
    • 已移动 Lawrence LvMicrosoft Contingent Staff 2012年7月27日 6:55 SharePoint silent installation file issue (From:Windows PowerShell)
    • 已移动 Pengyu Zhao 2012年7月27日 8:00 related to 2010 (From:SharePoint - Setup, Upgrade, Administration and Operation (pre-SharePoint 2010))
    •  

全部回复

  • 2012年7月26日 19:54
     
     已答复 包含代码

    Looks like

    $PIDKey = $PIDKey.TrimEnd()

    Will do the job. Let me know if I am living in a fools paradise!

    OldDog

    • 已标记为答案 OldDog1 2012年7月31日 15:51
    •