Link to home
Start Free TrialLog in
Avatar of 25112
25112

asked on

can powershell search xml?

can you suggest syntax for powershell to search for a particular phrase inside an xml file ?
SOLUTION
Avatar of Brad Groux
Brad Groux
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of footech
There are various ways you can work with .XML files.  If you provide a sample and say exactly what you are trying to do more specific guidance can be given.
Avatar of 25112
25112

ASKER

the file has extenstion .dtsconfig

the code is
---
<?xml version="1.0"?><DTSConfiguration><DTSConfigurationHeading><DTSConfigurationFileInfo GeneratedBy="SBret-PC\SBret" GeneratedFromPackageName="DownloadHeaderInfo" GeneratedFromPackageID="{76F224FA-D4D1-4CAA-8FA8-9YFDCC946EAB}" GeneratedDate="8/12/2014 3:13:03 PM"/></DTSConfigurationHeading><Configuration ConfiguredType="Property" Path="\Package.Connections[Dashboard].Properties[ConnectionString]" ValueType="String"><ConfiguredValue>Data Source=POS16\POSBoard;Initial Catalog=AMP;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto Translate=False;Application Name=SSIS-DownloadHeaderInfo;</ConfiguredValue></Configuration></DTSConfiguration>
---

can you please copy the above and then save in a text as DownloadHeaderInfo.dtsconfig .. this is what we need to search inside of.. for example, we may search for a string of 'POS16'..

thanks
OK, so you're seaching for the string "POS16".  Does it have to be in a certain field or anywhere in the file?  What do you need returned if it is found?
Avatar of 25112

ASKER

anywhere in the file.

we will searching so many dtsconfig files.. so just return a list of the files that contain this string, please?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 25112

ASKER

thank you very much- it worked.