Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- @rem Checking & Prompting for run as administrator
- @rem --------------------------------------------------------------------------
- @rem Checking for permissions...
- if "%PROCESSOR_ARCHITECTURE%" equ "amd64" (
- "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system">nul 2>&1
- ) else (
- "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system">nul 2>&1
- )
- if '%errorlevel%' neq '0' (
- @rem Administrator permissions not found
- echo Requesting administrative privileges...
- goto UACPrompt
- ) else (
- @rem Administrator permissions found
- goto gotAdmin
- )
- :UACPrompt
- echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
- set params= %*
- echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"
- "%temp%\getadmin.vbs"
- del "%temp%\getadmin.vbs"
- exit /B
- :gotAdmin
- pushd "%CD%"
- CD /D "%~dp0"
- @rem --------------------------------------------------------------------------
- title Get BitLocker Key
- set tempFile=%TEMP%\BitLockerKey.txt
- if exist %tempFile% del %tempFile%
- PowerShell -command "Get-BitLockerVolume -MountPoint C:| Select-Object -ExpandProperty KeyProtector | Where-Object KeyProtectorType -eq RecoveryPassword | Select-Object KeyProtectorID, RecoveryPassword | Format-List" > %tempFile%
- for /f "usebackq skip=1 tokens=2 delims=: " %%i in (%tempFile%) do set key=%%i
- echo:
- echo Your BitLocker Key Is: %key%
- echo:
- set /p doCopy="Would you like copy the key to your clipboard? (y/n) "
- if %doCopy%==y (
- echo | set /p=%key%| clip
- echo Key successfully copied!
- )
- if exist %tempFile% del %tempFile%
- echo:
- echo [Press any key to close this window]
- pause >nul
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement