2 つのワイルドカード (= と ,) の間でエンドユーザーの XML ファイルからテキストをフィルター処理したいと考えています。
XML ファイル:
<OPTIONS Product="Testing" Version="1.1">
<Domains>
<Domain Name="domain.local">
<Path>OU=Test1,OU=Users,OU=HQ,DC=domain,DC=local</Path>
</Domain>
<Domain Name="domain.local">
<Path>OU=Test2,OU=Users,OU=HQ,DC=domain,DC=local</Path>
</Domain>
</OPTIONS>
これまでの私のPowershellコード:
[xml]$optionsfile = Get-Content C:\test\options.xml
foreach( $ou in $optionsfile.Options.Domains.Domain )
{
$ou.Path
}
ここで、XML ファイルの最初の「=」と「,」の間のテキストのみを表示したいと考えています 。したがって、出力は次のようになります。
テスト1 テスト2
等...
使いたくない
$ou.Path | select-string -pattern "Test1"
ただし、2 つのワイルドカードの間でテキストをフィルタリングします。
前もって感謝します!