Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. Option Explicit
  2.  
  3. Dim strNumericalKeyID
  4. Dim strManageBDE,strManageBDE2
  5. Dim oShell
  6. Dim StrPath
  7. Dim StdOut, strCommand
  8. Dim Result, TPM, strLine
  9. Dim Flag, NumericalKeyID
  10.  
  11. Set oShell = CreateObject("WSCript.Shell")
  12. '====================================================================================
  13. 'Runs as Administrator
  14.  
  15. If Not WScript.Arguments.Named.Exists("elevate") Then
  16. CreateObject("Shell.Application").ShellExecute WScript.FullName _
  17. , WScript.ScriptFullName & " /elevate", "", "runas", 1
  18. WScript.Quit
  19. End If
  20.  
  21. '====================================================================================
  22. 'This section looks for the Bitlocker Key Numerical ID
  23.  
  24. strManageBDE = "C:\\Windows\System32\Manage-BDE.exe -protectors -get c:" 'Bitlocker command to gather the ID
  25.  
  26. Flag = False
  27.  
  28. Set Result = oShell.Exec(strManageBDE)'sees the results and places it in Result
  29.  
  30. Set TPM = Result.StdOut 'Sets the variable TPM to the output if the strManageBDe command
  31.  
  32. While Not TPM.AtEndOfStream
  33. strLine = TPM.ReadLine 'Sets strLine
  34. If InStr(strLine, "Numerical Password:") Then ' This section looks for the Numerical Password
  35. Flag = True
  36. End If
  37. If Flag = True Then
  38. If InStr(strLine, "ID:") Then 'This section looks for the ID
  39. NumericalKeyID = Trim(strLine)' This section trims the empty spaces from the ID {} line
  40. NumericalKeyID = Right(NumericalKeyID, Len(NumericalKeyID)-4)
  41. Flag = False 'Stops the other lines from being collected
  42. End If
  43. End If
  44. Wend
  45.  
  46. strManageBDE2 = "C:\\Windows\System32\Manage-BDE.exe -protectors -adbackup C: -ID " & NumericalKeyID
  47. oShell.Run strManageBDE2, 0, True 'Runs the Manage-bde command to move the numerical ID to AD.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement