Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2314

XML - datei mit Powershell bearbeiten und ein Abschnitt löschen

$
0
0

Hallo Community,

ich habe ein kleines Problem wo ich keine Lösung finde!

Ich habe eine XML Datei. wo ich den Abschnitt "PromptedSubscribers" löschen muss.

***XML - Datei *****************************************************************

<?xml version="1.0" encoding="UTF-8"?>
-<DocItemSet xmlns="urn:schema:Microsoft.Rtc.Management.Xds.AppLayer.2008">
+<DocItem OwnerPool="ServerID" Owner="ServerID" Signature="SIGID" ItemId="ItemID" Name="urn:confs:UserID">
+<DocItem OwnerPool="ServerID" Owner="ServerID" Signature="SIGID" ItemId="ItemID" Name="urn:confs:UserID">
-<DocItem OwnerPool="ServerID" Owner="ServerID" Signature="SIGID" ItemId="ItemID" Name="urn:confs:UserID">
-<Data>
-<HomedResource xmlns="http://schemas.microsoft.com/RtcServer/2002/11/dbimpexp" <Infos>
 +<ContactGroups>
 +<Contacts>
 -<PromptedSubscribers>
 <PromptedSubscriber> </PromptedSubscriber>
 <PromptedSubscriber> </PromptedSubscriber>
 <PromptedSubscriber> </PromptedSubscriber>
 <PromptedSubscriber/>
 <PromptedSubscriber> </PromptedSubscriber>
 <PromptedSubscriber> </PromptedSubscriber>
 </PromptedSubscribers>

+<Containers>
-<Delegates>
<Delegate

*********************************************************************

hier ist ein Teil das Scriptes

## XML datei Bearbeiten
$xmlDoc = New-Object XML
$xmlDoc.Load($extractFile)
$xmlDoc.DocumentElement.DocItem.SyncRoot.SyncRoot.data.homedresource.PromptedSubscribers.PromptedSubscriber
$xmlDoc.DocumentElement.DocItem.SyncRoot.SyncRoot.data.homedresource.Remove("PromptedSubscribers")

nach dem Ausführen erhalte ich diese Fehlermeldung

Ausnahme beim Aufrufen von "Remove" mit 1 Argument(en):  "Die Liste hatte eine feste Größe."
In Zeile:1 Zeichen:1
+ $xmlDoc.DocumentElement.DocItem.SyncRoot.SyncRoot.data.homedresource. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NotSupportedException

Wie kann ich diesen Abschnitt löschen??

Gruß

Stefan


Viewing all articles
Browse latest Browse all 2314


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