Something I hardly see mentioned here is encryption for data such as on your PC. My modus operandi is to encrypt all the things. This is a little .bat script I came up with to lock all drives, except the C: drive, all in one click.

It resides on my desktop as an icon, and i can lock all drives in a couple seconds vs doing it drive by drive.

Not sure if anyone here could use it, but I thought I’d share. I am sure that some of you real coders here could fine tune it a bit, and I’d be open to suggestions.

@echo off
REM Script to lock multiple BitLocker drives with admin privileges

REM Check for administrative privileges
net session >nul 2>&1
if %errorlevel% neq 0 (
    echo This script requires administrative privileges.
    echo Requesting elevation...
    REM Create a VBS script to trigger UAC prompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\elevate.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\elevate.vbs"
    cscript //nologo "%temp%\elevate.vbs"
    del "%temp%\elevate.vbs"
    exit /b
)

REM List of drives to lock
set drives=D: G: I: H: E: F: P: J:

REM Loop through each drive and lock it
for %%d in (%drives%) do (
    echo Locking drive %%d...
    manage-bde -lock %%d -ForceDismount
)

echo All specified drives have been locked.
pause
  • Brickfrog@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    2 days ago

    Thanks for the share! It’s not something I’d need to use but I’m all for people sharing their scripts with the community for this stuff :)

    One suggestion, you may want to look at re-writing your script to move away from the VBScript (.vbs) dependency since Microsoft is moving towards disabling and eventually removing it from Windows 11 and onward. It’ll likely be disabled by default in 2027 so you have plenty of time.

    https://techcommunity.microsoft.com/blog/windows-itpro-blog/vbscript-deprecation-timelines-and-next-steps/4148301

    • irmadlad@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 days ago

      Thanks to you for the tip, I did not know that. I’ve got two years to rewrite. Yaaayyy!

      As much time as I’ve put in to sanitizing it, building a wall around it, and imaging the results, building off the backs of other’s more knowledgeable than I, this is where is get off. I am not upgrading. Why upgrade to a huge advertising platform? I can’t wait to see how many data points that Microsoft would be slurping up. In W10 there’s something close to 5000 I’ve shut down so far. Wow!

      I have one piece of software I use for one of my retirement businesses. I cannot find a Linux alt equal feature for feature or even close. So, I’m kind of stuck with it,