Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Unexpected token in expression or statement

$
0
0

OK, so I'm completely new to Powershell and probably doing something fundametally wrong.

I'm tryingt o edit the contents of a xml file and switch a value from true to false.

<?xml version="1.0"?>
<Categories xmlns="link">
  <Category ID="Login">
    <Property Name="AutoLogin" Value="False" />
    <Property Name="ServerName" Value="SRV01" />
    <Property Name="UserName" Value="administrator" />
    <Property Name="SelectedAuthenticationType" Value="0" />
    <Property Name="Password" Value="m+FMtYXoDWY=" />
    <Property Name="DatabaseName" Value="Temp" />
    <Property Name="Expanded" Value="True" />
  </Category>
  <Category ID="GeneralOptions">
    <Property Name="ShowPartChildren" Value="True" />
    <Property Name="ShowFactory" Value="True" />
    <Property Name="SuppressMessageOnMemberGenerationFailed" Value="False" />
    <Property Name="OnlyCheckUnsavedParticipatingCheckinFiles" Value="False" />
    <Property Name="IgnoreCheckInMachineNameValidation" Value="False" />
    <Property Name="CheckInSuppressedFiles" Value="True" />
    <Property Name="UseLargeStatusIcons" Value="True" />
    <Property Name="GFN4SpecialFiles" Value="False" />
  </Category>
  <Category ID="CheckInDialogOptions">
    <Property Name="IncludeChildren" Value="True" />
    <Property Name="IncludeParents" Value="True" />
    <Property Name="DirectParentsOnly" Value="False" />
    <Property Name="KeepFilesCheckedOut" Value="False" />
    <Property Name="CreateDWFAttachment" Value="False" />
    <Property Name="SendToJobServer" Value="True" />
    <Property Name="CreateDWFAttachmentApplyToAllFiles" Value="False" />
    <Property Name="DeleteWorkingCopy" Value="False" />
    <Property Name="AutoCollectRelatedFiles" Value="False" />
    <Property Name="FileNameWidth" Value="66" />
    <Property Name="VaultFolderWidth" Value="77" />
    <Property Name="WorkingFolderWidth" Value="273" />
    <Property Name="Suppressed" Value="False" />
  </Category>

I want to change the value  <Property Name="SendToJobServer" Value="True" /> to False.

But keep getting this

$xmlFile = “C:\PS\ApplicationPreferences.xml”
$xmlDoc = [XML](gc $xmlFile)
$xmldoc."CheckInDialogOptions"."SendToJobServer" Value= "False"
Unexpected token 'Value=' in expression or statement.
At line:1 char:56
+ $xmldoc."CheckInDialogOptions"."SendToJobServer" Value= <<<<  "False"
    + CategoryInfo          : ParserError: (Value=:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

$xmldoc.Save($xmlFile)

Any Clues?

Thanks


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>