@@ -703,7 +703,8 @@ If($MenuShowAppSelection)
703
703
704
704
# Add apps selection from config
705
705
Add-AppContent - AppData $MenuAppButtonsItems
706
-
706
+
707
+ # enable the apptab
707
708
$ActiveBeginBtn = Enable-AppTab - FlipButtons - ReturnActiveBtn
708
709
}
709
710
Else {
@@ -1115,6 +1116,13 @@ $UI.Add_KeyDown({
1115
1116
# Region CLICKACTION: Allows UI to be updated based input
1116
1117
(WPFVar " Validate" - Wildcard).Add_Click({
1117
1118
1119
+ # first thing: capture if bypass mode key is pressed
1120
+ If ($null -ne $MenuAllowRuleBypassModeKey ){
1121
+ $CaptureBypassModeKey = Test-KeyPress - Keys $MenuAllowRuleBypassModeKey
1122
+ }Else {
1123
+ $CaptureBypassModeKey = $false
1124
+ }
1125
+
1118
1126
Invoke-UIMessage - Message (" Validating device name: {0}" -f (WPFVar " inputTxtComputerName" ).text) - HighlightObject (WPFVar " inputTxtComputerName" ) - OutputErrorObject (WPFVar " txtError" ) - Type Info
1119
1127
# Reset any highlighted input fields
1120
1128
Reset-HighlightedFields - Object (WPFVar " input" - Wildcard) - ClearErrorMessage
@@ -1124,6 +1132,7 @@ $UI.Add_KeyDown({
1124
1132
1125
1133
# check if name needs to be validated against rules
1126
1134
If ($ValidateComputerName -and $MenuEnableValidateNameRules ){
1135
+
1127
1136
$ValidateIdentity = Confirm-ComputerNameRules - SiteList $MenuLocaleSiteList `
1128
1137
- XmlRules $NameStandardRuleSets `
1129
1138
- ComputerNameObject (WPFVar " inputTxtComputerName" ) `
@@ -1143,6 +1152,17 @@ $UI.Add_KeyDown({
1143
1152
# update site info (and domain) by classification
1144
1153
Update-UIDomainFields - FilterLocale $ValidateIdentity.Id3 - FilterClass $ValidateIdentity.Id4 `
1145
1154
- WorkgroupOption:$MenuAllowWorkgroupJoin - ClassificationProperty $MenuShowClassificationProperty
1155
+
1156
+ If ($CaptureBypassModeKey )
1157
+ {
1158
+ # show it bypass mode was used
1159
+ Invoke-UIMessage - Message (' USER BYPASS MODE: Hold [{0}] and press Begin' -f ($MenuAllowRuleBypassModeKey -join " +" )) - HighlightObject (WPFVar " inputTxtComputerName" ) - OutputErrorObject (WPFVar " txtError" ) - Type OK
1160
+ $ValidateIdentity = $true
1161
+
1162
+ # hide dropdown & enable textbox
1163
+ ConvertTo-UITextBox - ComboBox (WPFVar " inputCmbDomainWorkgroupName" )
1164
+ Switch-TabItem - TabControlObject (WPFVar " subtabControl" ) - name ' Hardware'
1165
+ }
1146
1166
}
1147
1167
Else {
1148
1168
$ValidateIdentity = $ValidateComputerName
@@ -1165,30 +1185,49 @@ $UI.Add_KeyDown({
1165
1185
1166
1186
1167
1187
1188
+
1168
1189
# Region CLICKACTION: Begin will be enabled if validated is run
1169
1190
$ActiveBeginBtn.Add_Click ({
1170
1191
1192
+ # first thing: capture if bypass mode key is pressed
1193
+ If ($null -ne $MenuAllowRuleBypassModeKey ){
1194
+ $CaptureBypassModeKey = Test-KeyPress - Keys $MenuAllowRuleBypassModeKey
1195
+ }Else {
1196
+ $CaptureBypassModeKey = $false
1197
+ }
1198
+
1171
1199
# Reset any highlighted input fields
1172
1200
Reset-HighlightedFields - Object (WPFVar " input" - Wildcard) - ClearErrorMessage
1173
1201
1174
- # first check if the computer name meets basic standards
1175
- $ValidateComputerName = Confirm-ComputerNameField - ComputerNameObject (WPFVar " inputTxtComputerName" ) - OutputErrorObject (WPFVar " txtError" ) - ExcludeExample $NameStandardRuleExampleText
1202
+ If ($CaptureBypassModeKey ){
1203
+ $ValidateComputerName = $true
1204
+ }
1205
+ Else {
1206
+ # first check if the computer name meets basic standards
1207
+ $ValidateComputerName = Confirm-ComputerNameField - ComputerNameObject (WPFVar " inputTxtComputerName" ) - OutputErrorObject (WPFVar " txtError" ) - ExcludeExample $NameStandardRuleExampleText
1208
+ }
1176
1209
1177
1210
# check if name needs to be validated against rules (only if basic computer name is valid)
1178
- If ($ValidateComputerName -and $MenuEnableValidateNameRules )
1211
+ If ($CaptureBypassModeKey ){
1212
+ $ValidateComputerNameRules = $true
1213
+ }
1214
+ ElseIf ($ValidateComputerName -and $MenuEnableValidateNameRules )
1179
1215
{
1180
1216
$ValidateComputerNameRules = Confirm-ComputerNameRules - SiteList $MenuLocaleSiteList `
1181
- - XmlRules $NameStandardRuleSets `
1182
- - ComputerNameObject (WPFVar " inputTxtComputerName" ) `
1183
- - OutputErrorObject (WPFVar " txtError" ) - ReturnOption Variables
1217
+ - XmlRules $NameStandardRuleSets `
1218
+ - ComputerNameObject (WPFVar " inputTxtComputerName" ) `
1219
+ - OutputErrorObject (WPFVar " txtError" ) - ReturnOption Variables
1184
1220
Set-OSDIdentityVariables - VariableTable $ValidateComputerNameRules
1185
1221
}
1186
1222
Else {
1187
1223
$ValidateComputerNameRules = $true
1188
1224
}
1189
1225
1190
1226
# check if site code needs to be validated.
1191
- If ($MenuShowSiteCode )
1227
+ If ($CaptureBypassModeKey ){
1228
+ $ValidateSiteCode = $true
1229
+ }
1230
+ ElseIf ($MenuShowSiteCode )
1192
1231
{
1193
1232
$ValidateSiteCode = Confirm-SiteCode - SiteCodeObject (WPFVar " txtSiteCode" ) - OutputErrorObject (WPFVar " txtError" )
1194
1233
}
@@ -1197,7 +1236,13 @@ $ActiveBeginBtn.Add_Click({
1197
1236
}
1198
1237
1199
1238
# check if admin credentials are valid format. Ignor if using ODJ
1200
- If ($MenuGenerateNameMethod -like ' ODJ*' ){
1239
+ If ($CaptureBypassModeKey ){
1240
+ $ValidateAdminCreds = $true
1241
+ }
1242
+ ElseIf ($MenuGenerateNameMethod -like ' ODJ*' ){
1243
+ $ValidateAdminCreds = $true
1244
+ }
1245
+ ElseIf ($MenuHideDomainList -or $MenuHideDomainCreds ){
1201
1246
$ValidateAdminCreds = $true
1202
1247
}
1203
1248
Else {
@@ -1209,6 +1254,25 @@ $ActiveBeginBtn.Add_Click({
1209
1254
# all check must be valid to preceed
1210
1255
If ($ValidateSiteCode -and $ValidateComputerName -and $ValidateComputerNameRules -and $ValidateAdminCreds )
1211
1256
{
1257
+ # Build Parameters for OSD Variables
1258
+ $OSDParams = @ {ComputerName = (WPFVar " inputTxtComputerName" ).Text}
1259
+ If ($MenuHideDomainList -ne $true ){
1260
+ If ( (WPFVar " inputTxtDomainWorkgroupName" ).Text -eq ' Workgroup' ){
1261
+ $OSDParams += @ {DomainName = (WPFVar " inputTxtDomainWorkgroupName" ).Text}
1262
+ }Else {
1263
+ $OSDParams += @ {DomainName = (WPFVar " inputTxtDomainWorkgroupName" ).Text;DomainOU = (WPFVar " inputCmbDomainOU" ).Text}
1264
+ }
1265
+ }
1266
+ If ($MenuHideDomainCreds -ne $true ){
1267
+ If ( (WPFVar " inputTxtDomainWorkgroupName" ).Text -eq ' Workgroup' ){
1268
+ $OSDParams += @ {LocalAdminPassword = (WPFVar " inputTxtPassword" ).Password}
1269
+ }Else {
1270
+ $OSDParams += @ {AdminUsername = (WPFVar " inputTxtDomainAdminLocalAccount" ).Text;AdminPassword = (WPFVar " inputTxtPassword" ).Password}
1271
+ }
1272
+ }
1273
+ $OSDParams += @ {CMSiteCode = (WPFVar " txtSiteCode" ).Text}
1274
+
1275
+
1212
1276
# Set OSD variables for ODJ Join using a file
1213
1277
If ($MenuGenerateNameMethod -eq ' ODJFile' ){
1214
1278
Set-OSDOdjVariables - BlobFile $DeviceODJ.FullName - ComputerName (WPFVar " inputTxtComputerName" ).Text - LocalAdminPassword (WPFVar " inputTxtPassword" ).Password
@@ -1217,19 +1281,33 @@ $ActiveBeginBtn.Add_Click({
1217
1281
ElseIf ($MenuGenerateNameMethod -eq ' ODJBlob' ){
1218
1282
Set-OSDOdjVariables - BlobData $ODJBlobData - ComputerName (WPFVar " inputTxtComputerName" ).Text - DomainName (WPFVar " inputTxtDomainWorkgroupName" ).Text
1219
1283
}
1284
+ ElseIf ($MenuHideDomainList -and $MenuHideDomainCreds ){
1285
+ Set-OSDDomainVariables - ComputerName (WPFVar " inputTxtComputerName" ).Text
1286
+ }
1220
1287
# Set OSD variables for Workgroup Join
1221
1288
ElseIf ( ((WPFVar " inputTxtDomainWorkgroupName" ).Text -eq ' Workgroup' )){
1222
- Set-OSDWorkgroupVariables - ComputerName (WPFVar " inputTxtComputerName" ).Text - Workgroup (WPFVar " inputTxtDomainAdminLocalAccount" ).Text `
1289
+ If ($MenuHideDomainCreds ){
1290
+ Set-OSDWorkgroupVariables - ComputerName (WPFVar " inputTxtComputerName" ).Text - Workgroup (WPFVar " inputTxtDomainAdminLocalAccount" ).Text
1291
+ }Else {
1292
+ Set-OSDWorkgroupVariables - ComputerName (WPFVar " inputTxtComputerName" ).Text - Workgroup (WPFVar " inputTxtDomainAdminLocalAccount" ).Text `
1223
1293
- LocalAdminPassword (WPFVar " inputTxtPassword" ).Password
1294
+ }
1224
1295
}
1225
1296
# Set OSD variables for Domain Join
1226
1297
Else {
1227
- Set-OSDDomainVariables - ComputerName (WPFVar " inputTxtComputerName" ).Text - DomainName (WPFVar " inputTxtDomainWorkgroupName" ).Text - DomainOU (WPFVar " inputCmbDomainOU" ).Text`
1298
+ $DomainName = $MenuLocaleDomainList | Where {$_.FQDN -eq (WPFVar " inputTxtDomainWorkgroupName" ).Text} | Select - ExpandProperty Name
1299
+ If ($MenuHideDomainCreds ){
1300
+
1301
+ Set-OSDDomainVariables - ComputerName (WPFVar " inputTxtComputerName" ).Text - DomainName $DomainName - DomainFQDN (WPFVar " inputTxtDomainWorkgroupName" ).Text - DomainOU (WPFVar " inputCmbDomainOU" ).Text`
1302
+ - CMSiteCode (WPFVar " txtSiteCode" ).Text
1303
+ }Else {
1304
+ Set-OSDDomainVariables - ComputerName (WPFVar " inputTxtComputerName" ).Text - DomainName $DomainName - DomainFQDN (WPFVar " inputTxtDomainWorkgroupName" ).Text - DomainOU (WPFVar " inputCmbDomainOU" ).Text`
1228
1305
- AdminUsername (WPFVar " inputTxtDomainAdminLocalAccount" ).Text - AdminPassword (WPFVar " inputTxtPassword" ).Password `
1229
1306
- CMSiteCode (WPFVar " txtSiteCode" ).Text
1307
+ }
1230
1308
}
1231
1309
# Set OSD variables for Timezones/Locale
1232
- Set-OSDLocaleVariables - TimeZone ($AllTimeZones | Where DisplayName -eq (WPFVar " inputCmbTimeZoneList" ).SelectedItem)
1310
+ Set-OSDLocaleVariables - SelectedTimeZone ($AllTimeZones | Where { $_ .TimeZone -eq (WPFVar " inputCmbTimeZoneList" ).SelectedItem} )
1233
1311
# Set OSD variables for Applications
1234
1312
If ($MenuShowAppSelection ){Set-OSDAppVariables - AppObjects (WPFVar " tglAppInstall" - Wildcard) - AppList $MenuAppButtonsItems }
1235
1313
# Set OSD variables for Classification
0 commit comments