Batch – Script to Query BitLocker Info – Multiple Machines

email me

I created this script to query a list of computers. For me, I just needed the raw BitLocker data from the client machines dumped to a text file.

cls

@Echo off
Title BitLocker Report
color 0a
Setlocal EnableDelayedExpansion

REM INTERNAL VARIABLES
REM —————————————————————————-

REM ENTER NAME OF COMPUTER TEXT FILE
Set PCList=C:\scripts\_AD_Scripts\_ENGINE\computers.txt

REM CREATES DATE AND TIME TIMESTAMP
rem sets a static timestamp
for /F “tokens=2-4 delims=/- ” %%p in (‘date/T’) do set mdate=%%r%%p%%q
for /F “tokens=1-2 delims=:- ” %%p in (‘time/T’) do set mtime=%%p%%q
Set ReportN=%mdate%_%mtime%_%report%.txt
REM PROGRAM ROUTINE
:CYCLE
for /f “tokens=* delims=%%a in (%PCList%) do (

REM sets dynamic timestamp 
FOR /F “TOKENS=*” %%B IN (‘DATE/T’) DO SET NowD=%%B
FOR /F “TOKENS=*” %%A IN (‘TIME/T’) DO SET NowT=%%A

cls
echo Contacting %%a workstation name…
ping %%a | find “Reply” > nul
if errorlevel 1 (echo !NowD! !NowT!, %%a, OFFLINE >> “%ReportN%”
) else ( 
echo !NowD! !NowT!, %%a, ONLINE >> “%ReportN%cls
echo Found %%arem ———————————-
echo Reporting BitLocker Data %%a
ping -n 2 127.0.0.1>nul
echo.
manage-bde -cn %%a -protectors -get c:>>C:\scripts\_AD_Scripts\_ENGINE\RawData.txt
rem ———————————-

echo.
)
)

endlocal
exit /b 0