如何使用select-string在xml文件中查找产品guid?

时间:2013-04-10 12:08:50

标签: xml powershell powershell-v2.0

我们有一个xml文件,其中我们存储了少量属性guid。

我正在尝试使用powershell select-string cmdlet找到guid,但它不返回任何值。

GEt-content rules.xml | Select-String "5351BABA-40C2-477B-8111-DA54A48CD8EB"

guid在文件中,我手动验证。

为什么select-string无法找到产品guid?是否可以找到它是否可用?

xml文件中的示例内容

<Component Id="M_PostConfig" Name="Post-Configuration" StsDisplayEntry="Database Server Post-Configuration" StsDisplayText="Please wait while Post-Configuration is installed" UninstallCommand="&quot;%pTxtFoldrSystem32%\msiexec.exe&quot;" Version="2.30.1.3" UninstallParameters="/i {85bb61a2-e0d8-4c3b-83a7-d978dcd4b3d2} REMOVE=DBSERVER /L*V+ &quot;%pFoldrInstallPath%\Foundation\Install\MSI_Uninstall.log&quot; /qn msifeatwise" SupportUninstall="Yes"> </Component>
  

1 个答案:

答案 0 :(得分:0)

尝试([String](Get-Content rules.xml)) | Select-String "5351BABA-40C2-477B-8111-DA54A48CD8EB"

相关问题