title: Using batch to get ID from "manage-bde -get"
body: <p>I'm trying to automagically send a specific key to AD using a batch file.  I'm not able to use any other language unfortunately.  I'm using the results from:</p>
  
  <pre><code>manage-bde -protectors c: -get
  </code></pre>
  
  <p>and use the numerical password ID from that in this next code:</p>
  
  <pre><code>manage-bde -protectors -adbackup c: -id {numerical password ID}
  </code></pre>
  
  <p>Here's what I have so far (just trying to get the right key):</p>
  
  <pre><code>@echo off  
  manage-bde -protectors c: -get  
  echo+  
  echo+  
  echo+
  for /f "tokens=1,*" %%a in (' "manage-bde -protectors c: -get" ^| findstr ID') do set npi=%%b
  echo+
  echo+
  echo My Numerical Password ID:
  echo %npi%
  echo+
  pause
  </code></pre>
  
  <p>What I get is this:</p>
  
  <blockquote>
  BitLocker Drive Encryption: Configuration Tool version 6.1.7601<br/>
  Copyright (C) Microsoft Corporation. All rights reserved.<br/>
  <br/>
  Volume C: []<br/>
  All Key Protectors<br/>
  <br/>
  Numerical Password:<br/>
  ID: {DEDAF9BC-C42A-45A4-BB5D-609ED1898923} --I want this one--<br/>
  Password:<br/>
  648712-106084-513103-486041-654894-310619-687401-654068<br/>
  <br/>
  TPM:<br/>
  ID: {DEDAF9BC-C42A-45A4-BB5D-609ED1898923}<br/>
  <br/>
  <br/>
  My Numerical Password ID:<br/>
  {DEDAF9BC-C42A-45A4-BB5D-609ED1898923}<br/>
  <br/>
  Press any key to continue . . .<br/>
  </blockquote>
  
  <p>I figured it would just grab the 1st "ID" that it came to but it keeps pointing to the 2nd one under TPM.</p>
  
  <p>Any idea what I'm doing wrong?</p>
  
  <p>Thanks for the help,</p>
  
  <p>J</p>