Advertisement
Guest User

Diskpart Virtual Disk.bat

a guest
Jan 9th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.26 KB | None | 0 0
  1.     :: Creates a tmp file, with the code needed
  2.     :: This is then the input file to the diskpart command
  3.     :: Run this bat file with admin privliges
  4.     :: 'maximum' is storage size in MB
  5.     :: Always ist ERRORLEVELS in decreasing order
  6.     :: https://isc.sans.edu/diary/Virtual+Bitlocker+Containers
  7. @ECHO OFF
  8. SET Fname="C:\Users\user\Desktop\EncrVol.vhd"
  9.  
  10. ECHO 1. Mount
  11. ECHO 2. UNmount
  12. ECHO 3. Create New Volume
  13. ECHO 4. Exit
  14. ECHO.
  15. CHOICE /C 1234 /M "Enter your choice:"
  16.  
  17. IF ERRORLEVEL 4 GOTO End
  18. IF ERRORLEVEL 3 GOTO NewVol
  19. IF ERRORLEVEL 2 GOTO UNmount
  20. IF ERRORLEVEL 1 GOTO Mount
  21.  
  22. :Mount
  23.     echo select vdisk file=%Fname% > tmp
  24.     echo attach vdisk >> tmp
  25.     echo select partition 1 >> tmp
  26.     echo assign letter=k >> tmp
  27.     diskpart /s tmp
  28. GOTO End
  29.  
  30. :UNmount
  31.     echo select vdisk file=%Fname% > tmp
  32.     echo detach vdisk >> tmp
  33.     diskpart /s tmp
  34. GOTO End
  35.  
  36. :NewVol
  37.     echo create vdisk file=%Fname% maximum=5000 type=fixed > tmp
  38.     echo select vdisk file=%Fname% >> tmp
  39.     echo attach vdisk >> tmp
  40.     echo create partition primary >> tmp
  41.     echo select partition 1 >> tmp
  42.     echo format fs=ntfs label="Secret" >> tmp
  43.     echo active >> tmp
  44.     echo assign letter=k >> tmp
  45.     echo exit >> tmp
  46.     diskpart /s tmp
  47.  
  48.     Echo.
  49.     Echo Remember to encrypt the new volume
  50.     pause
  51. GOTO End
  52.  
  53. :End
  54.     Del tmp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement