title: How to change values in XML with Powershell
body: <p>I have a xml file and i want to change 2 values inside the XML</p>
  
  <p>XML:</p>
  
  <pre><code>&lt;INSTALLTYPE Value="Standalone" /&gt;  to  &lt;INSTALLTYPE Value="Workstation" /&gt;
  
  &lt;ELEVATELICENSE Value="None" /&gt;     to  &lt;ELEVATELICENSE Value="Workgroup" /&gt;
  </code></pre>
  
  <p>I tested several scripts which are provided in this database, but i am not able to change the values.</p>
  
  <p>Powershell: </p>
  
  <pre><code>$path = "C:\temp\Kofax.xml"
  $xml = [xml](Get-Content -Path $path)
  $xml.FileZilla3.VIRTUALRESCAN.INSTALLTYPE
  $node = $xml.FileZilla3.VIRTUALRESCAN.INSTALLTYPE| where {$_.Name -eq 'Standalone'}
  $node.'#text'= 'Workstation'
  $xml.Save($path)
  </code></pre>
  
  <p>XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;Registry&gt;
      &lt;HKEY_LOCAL_MACHINE&gt;
          &lt;SOFTWARE&gt;
              &lt;KOFAX&gt;
                  &lt;CONDOR Value="0" Type="integer"&gt;
                      &lt;OEMCODE Value="FUJITSU" /&gt;
                      &lt;OEMSUBCODE Value="fi6670" /&gt;
                      &lt;VRSSERVERS Value="0" Type="integer" /&gt;
                      &lt;ECLIPSELOGGING Value="0" /&gt;
                      &lt;MULTICOREPOLICY Value="0" Type="integer" /&gt;
                      &lt;MULTICOREMODE Value="4" Type="integer" /&gt;
                      &lt;MULTICOREQUEUESIZE Value="4" Type="integer" /&gt;
                      &lt;MULTICOREDUALSIDEIP Value="1" Type="integer" /&gt;
                      &lt;INITVIVONSEPTHREAD Value="1" Type="integer" /&gt;
                      &lt;VRSELITEDEMO Value="0" Type="integer" /&gt;
                      &lt;DISABLETASKWINDOWS Value="0" Type="integer" /&gt;
                      &lt;V1.0&gt;
                          &lt;ERRORAPPPATH&gt;
                              &lt;DEFAULT Value="C:\Program Files (x86)\Kofax\Capture\ImgCtls\bin" /&gt;
                          &lt;/ERRORAPPPATH&gt;
                          &lt;HELPPATH&gt;
                              &lt;DEFAULT Value="C:\ProgramData\Kofax\Vrs\Help" /&gt;
                          &lt;/HELPPATH&gt;
                          &lt;KFXSCAN.PXW&gt;
                              &lt;DEFAULT_SOURCE Value="Fujitsu fi-6670A with VRS with AIPE" /&gt;
                          &lt;/KFXSCAN.PXW&gt;
                          &lt;SCANNERID&gt;
                              &lt;SELECTED Value="Fujitsu fi-6670A" /&gt;
                          &lt;/SCANNERID&gt;
                      &lt;/V1.0&gt;
                      &lt;VERSION Value="V5.1.0265" /&gt;
                      &lt;KOFAXVERSION Value="5.1.1.13.0.2084" /&gt;
                      &lt;PATH Value="C:\Program Files (x86)\Kofax\Capture\ImgCtls\" /&gt;
                  &lt;/CONDOR&gt;
                  &lt;VIRTUALRESCAN&gt;
                      &lt;SILENTINSTALL Value="FALSE" /&gt;
                      &lt;ADMININFO&gt;
                          &lt;ASCENTINSTALL Value="FALSE" /&gt;
                      &lt;/ADMININFO&gt;
                      &lt;SHAREDELEMENTFOLDER Value="C:\ProgramData\Kofax\Vrs\Shared" /&gt;
                      &lt;SHAREDELEMENTSERVER Value="" /&gt;
                      &lt;VRSLANGUAGE Value="" /&gt;
                      &lt;VRSLANGUAGEID Value="0" Type="integer" /&gt;
                      &lt;KCLANGUAGE Value="" /&gt;
                      &lt;PROFILESYNCTIME Value="3" Type="integer" /&gt;
                      &lt;SYNCTIMETICKS Value="" /&gt;
                      &lt;INSTALLDIRECTORY Value="C:\Program Files (x86)\Kofax\Capture\ImgCtls\" /&gt;
                      &lt;INSTALLTYPE Value="Standalone" /&gt;
                      &lt;ORIGINALINSTALLTYPE Value="Standalone" /&gt;
                  &lt;/VIRTUALRESCAN&gt;
                  &lt;KOFAX_ISIS_SCANNER_SOURCE&gt;
                      &lt;SOURCE_NAME Value="Fujitsu fi-6670A with VRS with AIPE" /&gt;
                  &lt;/KOFAX_ISIS_SCANNER_SOURCE&gt;
                  &lt;KOFAX_TWAIN_DATA_SOURCE&gt;
                      &lt;SOURCE_NAME Value="Fujitsu fi-6670A with VRS with AIPE" /&gt;
                  &lt;/KOFAX_TWAIN_DATA_SOURCE&gt;
              &lt;/KOFAX&gt;
              &lt;KOFAX_IMAGE_PRODUCTS&gt;
                  &lt;VIRTUALRESCAN&gt;
                      &lt;INSTALLDIRECTORY Value="C:\Program Files (x86)\Kofax\Capture\ImgCtls\" /&gt;
                      &lt;PRODUCTCODE Value="{12345678-1234-1234-1234-123456789101}" /&gt;
                      &lt;ADMININFO&gt;
                          &lt;ACCEPTEDEULA Value="TRUE" /&gt;
                          &lt;ACTIVATEREMINDERDAYS Value="1" /&gt;
                          &lt;AFFINITYID Value="000000" /&gt;
                          &lt;ASCENTINSTALL Value="FALSE" /&gt;
                          &lt;COMPANY Value="" /&gt;
                          &lt;EMAIL Value="" /&gt;
                          &lt;GRACENOTIFIED Value="FALSE" /&gt;
                          &lt;INSTALLDIRECTORY Value="C:\Program Files (x86)\Kofax\Capture\ImgCtls" /&gt;
                          &lt;LASTACTIVATEREMINDER Value="0x00" /&gt;
                          &lt;LICENSEACTION Value="" /&gt;
                          &lt;LICENSECODE Value="" /&gt;
                          &lt;PARTNUMBER Value="" /&gt;
                          &lt;PRODUCTCODE Value="" /&gt;
                          &lt;REGISTERED Value="FALSE" /&gt;
                          &lt;SENDEMAIL Value="TRUE" /&gt;
                          &lt;SERIALNUMBER Value="" /&gt;
                          &lt;SILENTINSTALL Value="FALSE" /&gt;
                          &lt;SKIPREGISTRATION Value="FALSE" /&gt;
                          &lt;STARTMENUFOLDER Value="" /&gt;
                          &lt;USERNAME Value="" /&gt;
                      &lt;/ADMININFO&gt;
                  &lt;/VIRTUALRESCAN&gt;
              &lt;/KOFAX_IMAGE_PRODUCTS&gt;
          &lt;/SOFTWARE&gt;
      &lt;/HKEY_LOCAL_MACHINE&gt;
      &lt;HKEY_CURRENT_USER&gt;
          &lt;SOFTWARE&gt;
              &lt;KOFAX&gt;
                  &lt;CONDOR&gt;
                      &lt;V1.0&gt;
                          &lt;SETTINGS&gt;
                              &lt;HWERRORS Value="1" Type="integer" /&gt;
                              &lt;STOPMODE Value="3" Type="integer" /&gt;
                              &lt;ELEVATELICENSE Value="None" /&gt;
                              &lt;IGNORECAPTURELICENSE Value="0" Type="integer" /&gt;
                              &lt;LEGACYBCLICENSE Value="0" Type="integer" /&gt;
                              &lt;PERFORMHOSTSMOOTHING Value="0" Type="integer" /&gt;
                              &lt;UPGRADECAPTURELICENSE Value="0" Type="integer" /&gt;
                          &lt;/SETTINGS&gt;
                      &lt;/V1.0&gt;
                  &lt;/CONDOR&gt;
              &lt;/KOFAX&gt;
          &lt;/SOFTWARE&gt;
      &lt;/HKEY_CURRENT_USER&gt;
  &lt;/Registry&gt;
  </code></pre>
  
  <p>Error Message:</p>
  
  <blockquote>
    <p>The property "#text" was not found for this object. Make sure that the
    property exists and can be set. In line: 5 characters: 1
    + $node.'#text'= 'Workstation'
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : PropertyNotFound</p>
  </blockquote>