[SOLVED] How to get a list of file name that has specific string in the file content?

Discussion in 'Scripting' started by xinso, Dec 14, 2016.

  1. xinso

    xinso MDL Guru

    Mar 5, 2009
    4,449
    5,578
    150
    #1 xinso, Dec 14, 2016
    Last edited by a moderator: Apr 20, 2017
    My WinSxS store is not complete for removing too many packages, which cause the Windows Update fail to update my Windows. So I have to do the update by installing each and every package from an extracted Windows Update CAB. But it wastes lots of time installing 5000 packages, of which most are not applicable to my system.
    Code:
    部署映像服務與管理工具
    版本: 10.0.14393.0
    
    映像版本: 10.0.14393.0
    
    正在處理 1 的 1 - 正在新增封裝 Package_2334_for_KB3206632~31bf3856ad364e35~amd64
    ~~10.0.1.8
    [==========================100.0%==========================]
    操作順利完成。
    
    部署映像服務與管理工具
    版本: 10.0.14393.0
    
    映像版本: 10.0.14393.0
    
    正在處理 1 的 1 - 正在新增封裝 Package_2335_for_KB3206632~31bf3856ad364e35~amd64
    ~~10.0.1.8
    [==========================100.0%==========================]
    錯誤: 0x800f081e
    
    指定的封裝不適用於此映像。
    
    在 C:\windows\Logs\DISM\dism.log 中可找到 DISM 記錄檔
    
    Normally, the Windows Cumulative Update includes packages for WinPE, Windows 10, and Windows Server. And I need only those for any one of them.

    For example, I need only Server related packages to update my Server 2016, so I need a list of those .mum files that has the specific Microsoft-Windows-Server string in the file content:

    Windows10.0-KB3206632-x64-14393.576.1.8\package_1367_for_kb3206632~31bf3856ad364e35~amd64~~10.0.1.8.mum
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v3" manifestVersion="1.0" description="Fix for KB3206632" displayName="default" company="Microsoft Corporation" copyright="Microsoft Corporation" supportInformation="http://support.microsoft.com/?kbid=3206632" creationTimeStamp="2016-12-11T01:03:54Z" lastUpdateTimeStamp="2016-12-11T01:03:54Z">
      <assemblyIdentity name="Package_1637_for_KB3206632" version="10.0.1.8" language="neutral" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" />
      <package identifier="KB3206632" releaseType="Security Update" restart="possible">
        <parent buildCompare="EQ" integrate="separate" disposition="detect">
          <assemblyIdentity name="Microsoft-OneCore-Update-Ux-Core-Package" language="uk-UA" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
          <assemblyIdentity name="Microsoft-OneCore-Update-Ux-Ppi-Package" language="uk-UA" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
          <parent buildCompare="EQ" integrate="separate" disposition="detect">
            <assemblyIdentity name="Microsoft-Windows-CoreCountrySpecificEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-CoreEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-CoreNEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-CoreSingleLanguageEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-EducationEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-EducationNEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-EnterpriseEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-EnterpriseEvalEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-EnterpriseNEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-EnterpriseNEvalEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-EnterpriseSEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-EnterpriseSEvalEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-EnterpriseSNEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-EnterpriseSNEvalEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-PPIProEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-ProfessionalEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-ProfessionalNEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-ServerDatacenterCorEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-ServerDatacenterEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-ServerDatacenterEvalCorEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-ServerDatacenterEvalEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-ServerHyperCoreEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-ServerSolutionEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-ServerStandardCorEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-ServerStandardEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-ServerStandardEvalCorEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-ServerStandardEvalEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-ServerStorageStandardEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
            <assemblyIdentity name="Microsoft-Windows-ServerStorageWorkgroupEdition" language="neutral" version="10.0.14393.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" buildType="release" />
          </parent>
        </parent>
        <installerAssembly name="Microsoft-Windows-ServicingStack" version="6.0.0.0" language="neutral" processorArchitecture="amd64" versionScope="nonSxS" publicKeyToken="31bf3856ad364e35" />
        <update name="3206632-3160_neutral">
          <applicable disposition="staged">
            <updateComponent elevate="revision">
              <assemblyIdentity name="Microsoft-Windows-Update-UX-MusUpdateHandlers.Resources" version="10.0.14393.351" processorArchitecture="amd64" language="uk-UA" buildType="release" publicKeyToken="31bf3856ad364e35" versionScope="nonSxS" />
            </updateComponent>
          </applicable>
          <component>
            <assemblyIdentity name="aa76a5d9557077fcc725099983e3cf38" version="10.0.14393.351" processorArchitecture="amd64" language="neutral" buildType="release" publicKeyToken="31bf3856ad364e35" versionScope="nonSxS" />
          </component>
        </update>
      </package>
    </assembly>
    Please!
     
  2. MSMG

    MSMG MDL Developer

    Jul 15, 2011
    2,136
    4,973
    90
    #2 MSMG, Dec 14, 2016
    Last edited by a moderator: Apr 20, 2017
    Code:
    
    @echo pff
    
      for /f %%z IN ('"dir /b Windows10.0-KB3206632-x64-14393.576.1.8\package*.manifest" 2^>nul') do (
        for /f "tokens=* delims=Package_1637_for_KB3206632" %%a in ('type %%z ^| find /I "Microsoft-Windows-Server"') do (
          echo.%%z>>List.txt
        )
      )
    
    
     
  3. xinso

    xinso MDL Guru

    Mar 5, 2009
    4,449
    5,578
    150
    #3 xinso, Dec 15, 2016
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Thank you so much.