-
Notifications
You must be signed in to change notification settings - Fork 1
/
DeployWiz_BitLocker.vbs
executable file
·202 lines (145 loc) · 4.89 KB
/
DeployWiz_BitLocker.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
' // ***************************************************************************
' //
' // Copyright (c) Microsoft Corporation. All rights reserved.
' //
' // Microsoft Deployment Toolkit Solution Accelerator
' //
' // File: DeployWiz_BitLocker.vbs
' //
' // Version: 6.3.8330.1000
' //
' // Purpose: BitLocker wizard pane initialization script
' //
' // ***************************************************************************
Option Explicit
Function InitializeBDE
Dim sType
sType = ucase(Property("BdeInstall"))
If sType = "" then
sType = ucase(Property("OSDBitLockerMode"))
End if
Select Case sType
Case "TPM"
BdeRadio2.checked = true
BdeModeRadio1.checked = true
Case "TPMKEY"
BdeRadio2.checked = true
BdeModeRadio2.checked = true
If Property("BdeKeyLocation") <> "" then
BdeModeSelect1.Value = ucase(Property("BdeKeyLocation"))
ElseIf Property("OSDBitLockerStartupKeyDrive") <> "" then
BdeModeSelect1.Value = ucase(Property("OSDBitLockerStartupKeyDrive"))
End if
Case "KEY"
BdeRadio2.checked = true
BdeModeRadio3.checked = true
If Property("BdeKeyLocation") <> "" then
BdeModeSelect2.Value = ucase(Property("BdeKeyLocation"))
ElseIf Property("OSDBitLockerStartupKeyDrive") <> "" then
BdeModeSelect2.Value = ucase(Property("OSDBitLockerStartupKeyDrive"))
End if
Case "TPMPIN"
BdeRadio2.checked = true
BdeModeRadio4.checked = true
If oEnvironment.item("BdePin") <> "" then
BdePin.value = oEnvironment.item("BdePin")
End if
Case Else
BdeRadio1.Checked = true
End Select
If UCase(Property("BdeRecoveryKey")) = "AD" or UCase(Property("OSDBitLockerCreateRecoveryPassword")) = "AD" Then
ADButton1.checked = True
Else
ADButton2.Checked = True
End if
WaitForEncryption.checked = ucase(Property("OSDBitLockerWaitForEncryption")) = "TRUE" or ucase(Property("BdeWaitForEncryption")) = "TRUE"
BdeInstallSuppress.value = "YES"
End Function
Function ValidateBDE
Dim regEx
' Enable and disable
If BDERadio2.checked then
' Enable second set of radio buttons
BdeModeRadio1.disabled = false
BdeModeRadio2.disabled = false
BdeModeRadio3.disabled = false
BdeModeRadio4.disabled = false
BdePin.disabled = false
ADButton1.disabled = false
ADButton2.disabled = false
WaitForEncryption.disabled = false
Else
' Disable second set of radio buttons
BdeModeRadio1.disabled = true
BdeModeRadio2.disabled = true
BdeModeRadio3.disabled = true
BdeModeRadio4.disabled = true
BdeModeSelect1.disabled = true
BdeModeSelect2.disabled = true
BdePin.disabled = true
ADButton1.disabled = true
ADButton2.disabled = true
WaitForEncryption.disabled = true
End if
' Set BdeInstall based on choices
If BDERadio2.checked then
BdeInstallSuppress.value = "NO"
' Mode/location
If BdeModeRadio1.checked then
BdeInstall.value = "TPM"
BdePin.disabled = true
ElseIf BdeModeRadio2.checked then
BdeInstall.value = "TPMKey"
OSDBitLockerStartupKeyDrive.value = BdeModeSelect1.Value
BdeModeSelect1.disabled = false
BdeModeSelect2.disabled = true
BdePin.disabled = true
ElseIf BdeModeRadio3.checked then
BdeInstall.value = "Key"
OSDBitLockerStartupKeyDrive.value = BdeModeSelect2.Value
BdeModeSelect1.disabled = true
BdeModeSelect2.disabled = false
BdePin.disabled = true
Else
BdeInstall.value = "TPMPin"
BdeModeSelect1.disabled = true
BdeModeSelect2.disabled = true
BdePin.disabled = false
End if
If ADButton1.checked Then
BdeRecoveryKey.value = "AD"
Else
BdeRecoveryKey.value = ""
End if
OSDBitLockerWaitForEncryption.value = WaitForEncryption.checked
Else ' IF BDERadio1.Checked then
BdeInstall.value = ""
BdeInstallSuppress.value = "YES"
End if
ValidateKey
' Scan required fields
ValidateBDE = ParseAllWarningLabels
End Function
Function ValidateKey
InvalidKey.style.display = "none"
ValidateKey = TRUE
If not BdeModeRadio4.Checked or not BDERadio2.Checked then
BdePin.value = ""
Exit Function
End if
If len(BdePin.value) = 0 Then
InvalidKey.innerText = "* Required (MISSING)"
InvalidKey.style.display = "inline"
ValidateKey = FALSE
ElseIf Not IsEmpty(oEnvironment.item("BDEPinMinLength")) And isNumeric(oEnvironment.item("BDEPinMinLength")) then
if len(BdePin.value) < cLng(oEnvironment.item("BDEPinMinLength")) then
InvalidKey.innerText = "* Pin must be " & oEnvironment.item("BDEPinMinLength") & " charaters or longer"
InvalidKey.style.display = "inline"
ValidateKey = FALSE
End if
ElseIf (oEnvironment.item("BDEAllowAlphaNumericPin") <> UCase("YES")) and Not IsNumeric(BdePin.value) then
InvalidKey.innerText = "* Pin must be numeric"
InvalidKey.style.display = "inline"
ValidateKey = FALSE
End if
End Function