BitLocker Encryption Progress Bar

It can take an hour or two to encrypt your hard drive. I wanted a visual aide to tell me how it was doing.
This vbScript creates a web page and a simple graph that will tell you how far along the encryption process is;
On Error Resume Next
Set objExplorer = CreateObject("InternetExplorer.Application")
objExplorer.Navigate "about:blank"  
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width=200
objExplorer.Height = 450
objExplorer.Left = 0
objExplorer.Top = 0
Do While (objExplorer.Busy)
    Wscript.Sleep 200
Loop   
objExplorer.Document.Title = "BitLocker Conversion Progress"
objExplorer.Visible = 1    
arrComputers = Array("10", "20", "30", "40", "50", "60", "70", "80", "90", "100")
strHTML = "<h2>BitLocker Conversion Progress</h2>"
strHTML = strHTML & "<table id=’ComputerList’ width=’100%’ border>"
For Each strComputer in arrComputers
    strHTML = strHTML & "  <tr>"
    strHTML = strHTML & "  <td width=’100%’>" & strComputer & "%</td>"
    strHTML = strHTML & "  </tr>"
Next
strHTML = strHTML & "</table>"
objExplorer.Document.Body.InnerHTML = strHTML
Wscript.Sleep 2000
    strComputer = arrComputers(i)
 Set objWMIService = GetObject("winmgmts:\" & "." _
    & "rootCIMV2SecurityMicrosoftVolumeEncryption")
 If Err = 0 Then
  Set volumes = objWMIService.InstancesOf("Win32_EncryptableVolume")
  cs = 2
  For Each volume in volumes
   If volume.DriveLetter = "C:" Then 
    retval = volume.GetEncryptionMethod(em)    
    retval1 = volume.GetConversionStatus(cs,ep)
   If (cs = 1) And (em = 1) Then 
         objExplorer.Quit
         Wscript.Echo "Ready for EFS decryption!!!!!!!"
         wscript.quit  ‘ Put decrypt here !!!!!!!
‘  Loop until Conversion complete 
   ElseIf (cs = 2) Then
          Do While cs = 2
       retval = volume.GetEncryptionMethod(em)    
    retval1 = volume.GetConversionStatus(cs,ep)
    Wscript.Echo em & vbTab & cs & vbTab & ep
        If ep >=10 Then
        i = 0
       objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "lightgreen"
       ElseIf ep >=1 And ep < 10 Then
       objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "yellow"
       End If
       
       If ep > 20 Then
     i = 1
     objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "lightgreen"
       ElseIf ep > 10 And ep < 20 Then
       objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "yellow"
     End If
     
     If ep > 30 Then
       i = 2
       objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "lightgreen"
     ElseIf ep > 20 And ep < 30 Then
     objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "yellow"
       End If
       
       If ep > 40  Then
       i = 3
       objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "lightgreen"
       ElseIf ep > 30 And ep < 40 Then
       objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "yellow"
       End If
     
     If ep > 50 Then
       i = 4
       objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "lightgreen"
     ElseIf ep >= 40 And ep < 50 Then
     objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "yellow"
       End If
       
       If ep > 60 Then
       i = 5
       objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "lightgreen"   
       ElseIf ep >= 50 And ep < 60 Then
       objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "yellow"
       End If
       
       If ep > 70 Then
       i = 6
       objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "lightgreen"
       ElseIf ep >= 60 And ep < 70  Then
       objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "yellow"
       End If
       
       If ep > 80 Then
       i = 7
       objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "lightgreen"
       ElseIf ep >= 70 And ep < 80 Then
       objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "yellow"
       End If
       
       If ep > 90 Then
       i = 8
       objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "lightgreen"
       ElseIf ep >= 80 And ep < 90 Then
       objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "yellow"
       End If
       
       If ep = 100 Then
       i = 9
       objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "lightgreen"
       ElseIf ep >= 90 And ep < 100 Then
       objExplorer.Document.Body.All.ComputerList.Rows(i).bgColor = "yellow"
       End If
       i = 0
       Wscript.Sleep 60000
      Loop
   End If
  End If
    Err.Clear
 Next
End If
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s