title: find gpo's in gpresult (for/find/findstr)
body: <p>I wan't some specific rules for different gpo's, if I use: "gpresult /r /scope user" I get to see which GPO's (security groups) are active. Now how can I filter some of these active GPO's to my batch file?
  This is part of the outcome from my gpresult:</p>
  
  <pre><code>De gebruiker is lid van de volgende beveiligingsgroepen
        Domain Users
        Iedereen
        SophosAdministrator
        SophosUser
        BUILTIN\Administrators
        Gebruikers
        INTERACTIEF
        AANMELDEN OP DE CONSOLE
        Geverifieerde gebruikers
        Deze organisatie
        LOKAAL
        Iedereen
        GS_08_cv's
        Tekenkamer
        GS_03_verslagen_openbaar
        GS_07_overeenkomsten
        GS_01_facturen
        GS_04_Functieprofielen
        GS_00_documenten
        AEC
        GS_02_functioneringsgesprekken
        GS_06_offertes
        GS_05_Arbeidsovereenkomsten
        GS_09_ aanbevelingsbrieven
        GS_03_verslagen_beperkt
        Systeembeheer
        Hoog verplicht niveau
  </code></pre>
  
  <p>I know I can search for a specific name (string?) with findstr, <strong>i.e.</strong></p>
  
  <pre><code>gpresult /r /scope user | findstr /L /i "SysteemBeheer" &gt; nul 2&gt;&amp;1
  REM *alternative* gpresult /r /scope user | FIND /i "SysteemBeheer" &gt; nul 2&gt;&amp;1
  IF %ERRORLEVEL% EQU 0 (ECHO Sys.Beheer) ELSE ECHO NO.sys.beheer
  </code></pre>
  
  <p>But how can I change it so multiple lines being read?</p>
  
  <p><strong>i.e.</strong> (borrowed some code just for example)</p>
  
  <pre><code>systeminfo | find "Microsoft Windows" &gt; %TEMP%\osname.txt
  FOR /F "usebackq delims=: tokens=2" %%i IN (%TEMP%\osname.txt) DO set vers=%%i
  
  echo %vers% | find "Windows 7" &gt; nul
  if %ERRORLEVEL% == 0 goto ver_7
  
  echo %vers% | find "Windows Server 2008" &gt; nul
  if %ERRORLEVEL% == 0 goto ver_2008
  
  echo %vers% | find "Windows Vista" &gt; nul
  if %ERRORLEVEL% == 0 goto ver_vista
  
  goto warnthenexit
  </code></pre>
  
  <p>I mean this does search for multiple variables I hope to some how find multiple Security Groups (GPO's) from the gpresult function (or perhaps a better way?)</p>
  
  <p>I'd like it to do something like this, <em>if systeembeheer exist do blaat1</em><strong>,</strong> <em>if aec exist do blaat2</em><strong>,</strong> <em>if tekenkamer exist do blaat3</em><strong>,</strong> BUT multiple GPO's can exists SO the script/search must not stop if 1 of the above does exist, it still has to look if one of the others also exist.</p>
  
  <p>***Perhaps a little more like this?</p>
  
  <pre><code>@echo off
  CLS
  setlocal enabledelayedexpansion
  
  for %%i in (systeembeheer tekenkamer aec) do (
      gpresult /r /scope user | findstr /L /i %%i
      if errorlevel 0 if not errorlevel 1 echo %%i ok process found !errorlevel!
      if errorlevel 1 if not errorlevel 2 echo %%i no process found !errorlevel!
  )
  
  :exit
  pause
  </code></pre>
  
  <p><strong>AND changed it a litte:</strong></p>
  
  <pre><code>@ECHO OFF
  CLS
  SETLOCAL ENABLEEXTENSIONS
  SETLOCAL ENABLEDELAYEDEXPANSION
  
  for %%i in (SysteemBeheer Administratie PersoneelsZaken TeamPlan) do (
      gpresult /r /scope user | findstr /L /i %%i &gt; nul 2&gt;&amp;1
      if errorlevel 0 if not errorlevel 1 Set "GPO_%%i=True"
      if errorlevel 1 if not errorlevel 2 Set "GPO_%%i=False"
  REM if errorlevel 0 if not errorlevel 1 echo %%i ok process found !errorlevel! *debug lines*
  REM if errorlevel 1 if not errorlevel 2 echo %%i no process found !errorlevel! *debug lines*
  )
  
  if "%GPO_systeemBeheer%" == "True" (Echo GPO_SysteemBeheer=%GPO_systeemBeheer%) else Echo GPO_SysteemBeheer Not Found!
  if "%GPO_Administratie%" == "True" (Echo GPO_Administratie=%GPO_Administratie%) else Echo GPO_Administratie Not Found!
  if "%GPO_PersoneelsZaken%" == "True" (Echo GPO_PersoneelsZaken=%GPO_PersoneelsZaken%) else Echo GPO_PersoneelsZaken Not Found!
  if "%GPO_TeamPlan%" == "True" (Echo GPO_TeamPlan=%GPO_TeamPlan%) else Echo GPO_TeamPlan Not Found!
  
  :exit
  echo.
  echo.
  PAUSE
  </code></pre>
  
  <p>This does seem to do what I want, bu i'm not sure if it's the best way or the right way to do it ???</p>