Auto lock external bitlocker encrypted drive, when idle or with lock screen

%3CLINGO-SUB%20id%3D%22lingo-sub-2860451%22%20slang%3D%22en-US%22%3EAuto%20lock%20external%20bitlocker%20encrypted%20drive%2C%20when%20idle%20or%20with%20lock%20screen%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2860451%22%20slang%3D%22en-US%22%3E%3CP%3EAny%20chance%3F%20Today%20we%20need%20to%20script%20(manage-bde%20D%2FE%2FF%3A%20-lock)%20task%20schedule%20event%20(on%20workstation%20lock%2Funlock)%2C%20to%20lock%20external%20or%20data%20drives%20when%20AFK.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2860451%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESecurity%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2862571%22%20slang%3D%22en-US%22%3ERe%3A%20Auto%20lock%20external%20bitlocker%20encrypted%20drive%2C%20when%20idle%20or%20with%20lock%20screen%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2862571%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1149868%22%20target%3D%22_blank%22%3E%40dvaguirre%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20follow%20the%20step%2C%20the%20solution%20could%20be%20useful%20for%20you.%3C%2FP%3E%3CP%3E1.%20Copy%20the%20below%20script%20and%20save%20it%20as%20%3CSTRONG%3Ebde.cmd%3C%2FSTRONG%3E%20inside%20the%20folder%20at%20%3CSTRONG%3Ec%3A%5Cbde-script%3C%2FSTRONG%3E.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%40echo%20off%0ATitle%20BitLocker%20Drive%20Auto-Lock%0A%0Aif%20exist%20d%3A%5C%20%25windir%25%5Csystem32%5Cmanage-bde%20-lock%20d%3A%0Aif%20exist%20e%3A%5C%20%25windir%25%5Csystem32%5Cmanage-bde%20-lock%20e%3A%0Aif%20exist%20f%3A%5C%20%25windir%25%5Csystem32%5Cmanage-bde%20-lock%20f%3A%0Aif%20exist%20g%3A%5C%20%25windir%25%5Csystem32%5Cmanage-bde%20-lock%20g%3A%0Aif%20exist%20h%3A%5C%20%25windir%25%5Csystem32%5Cmanage-bde%20-lock%20h%3A%0A%0AREM%20You%20can%20add%20drive%20letter%20as%20per%20the%20requirement%3B%0A%0A%40pause%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EYou%20can%20run%20it%20manually%20from%20the%26nbsp%3B%3CSTRONG%3ERUN%3C%2FSTRONG%3E%20command%20(WIN%20%2BR)%2C%20or%20you%20can%20add%20the%20%3CSTRONG%3ETask%20scheduler%3C%2FSTRONG%3E.%20There%20is%20possibility%20that%20we%20can%20add%20it%20to%20the%26nbsp%3B%3CSTRONG%3Econtext%20menu%2C%20%3C%2FSTRONG%3Eif%20you%20need%20I%20can%20also%20share%20the%20registry%20values.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Any chance? Today we need to script (manage-bde D/E/F: -lock) task schedule event (on workstation lock/unlock), to lock external or data drives when AFK. 

 

EDIT: And a context menu to lock/unlock those drives?

1 Reply

Hi @dvaguirre,

 

Please follow the step, I hope the solution could be useful for your Bitlocker application.

 

1. Copy the below script and save it as bde.cmd inside the folder at c:\bde-script.

 

 

@echo off
Title BitLocker Drive Auto-Lock

if exist d:\ %windir%\system32\manage-bde -lock d:
if exist e:\ %windir%\system32\manage-bde -lock e:
if exist f:\ %windir%\system32\manage-bde -lock f:
if exist g:\ %windir%\system32\manage-bde -lock g:
if exist h:\ %windir%\system32\manage-bde -lock h:

REM You can add more drive letters as per your requirement;

@pause

 

 

You can run it manually from the RUN command (WIN +R), or you can add the Task scheduler. There is the possibility that we can add it to the context menu, if you need I can also share the registry values.