|
| 1 | +function Invoke-CIPPStandardEnrollmentWindowsHelloForBusinessConfiguration { |
| 2 | + <# |
| 3 | + .FUNCTIONALITY |
| 4 | + Internal |
| 5 | + .COMPONENT |
| 6 | + (APIName) EnrollmentWindowsHelloForBusinessConfiguration |
| 7 | + .SYNOPSIS |
| 8 | + (Label) Windows Hello for Business enrollment configuration |
| 9 | + .DESCRIPTION |
| 10 | + (Helptext) Sets the Windows Hello for Business configuration during device enrollment. |
| 11 | + (DocsDescription) Sets the Windows Hello for Business configuration during device enrollment. |
| 12 | + .NOTES |
| 13 | + CAT |
| 14 | + Intune Standards |
| 15 | + TAG |
| 16 | + EXECUTIVETEXT |
| 17 | + Enables or disables Windows Hello for Business during device enrollment, enhancing security through biometric or PIN-based authentication methods. This ensures that devices meet corporate security standards while providing a user-friendly sign-in experience. |
| 18 | + ADDEDCOMPONENT |
| 19 | + {"type":"autoComplete","name":"standards.EnrollmentWindowsHelloForBusinessConfiguration.state","label":"Configure Windows Hello for Business","multiple":false,"options":[{"label":"Not configured","value":"notConfigured"},{"label":"Enabled","value":"enabled"},{"label":"Disabled","value":"disabled"}]} |
| 20 | + {"type":"switch","name":"standards.EnrollmentWindowsHelloForBusinessConfiguration.securityDeviceRequired","label":"Use a Trusted Platform Module (TPM)","default":true} |
| 21 | + {"type":"number","name":"standards.EnrollmentWindowsHelloForBusinessConfiguration.pinMinimumLength","label":"Minimum PIN length (4-127)","default":4} |
| 22 | + {"type":"number","name":"standards.EnrollmentWindowsHelloForBusinessConfiguration.pinMaximumLength","label":"Maximum PIN length (4-127)","default":127} |
| 23 | + {"type":"autoComplete","name":"standards.EnrollmentWindowsHelloForBusinessConfiguration.pinLowercaseCharactersUsage","label":"Lowercase letters in PIN","multiple":false,"options":[{"label":"Not allowed","value":"disallowed"},{"label":"Allowed","value":"allowed"},{"label":"Required","value":"required"}]} |
| 24 | + {"type":"autoComplete","name":"standards.EnrollmentWindowsHelloForBusinessConfiguration.pinUppercaseCharactersUsage","label":"Uppercase letters in PIN","multiple":false,"options":[{"label":"Not allowed","value":"disallowed"},{"label":"Allowed","value":"allowed"},{"label":"Required","value":"required"}]} |
| 25 | + {"type":"autoComplete","name":"standards.EnrollmentWindowsHelloForBusinessConfiguration.pinSpecialCharactersUsage","label":"Special characters in PIN","multiple":false,"options":[{"label":"Not allowed","value":"disallowed"},{"label":"Allowed","value":"allowed"},{"label":"Required","value":"required"}]} |
| 26 | + {"type":"number","name":"standards.EnrollmentWindowsHelloForBusinessConfiguration.pinExpirationInDays","label":"PIN expiration (days) - 0 to disable","default":"0"} |
| 27 | + {"type":"number","name":"standards.EnrollmentWindowsHelloForBusinessConfiguration.pinPreviousBlockCount","label":"PIN history - 0 to disable","default":"0"} |
| 28 | + {"type":"switch","name":"standards.EnrollmentWindowsHelloForBusinessConfiguration.unlockWithBiometricsEnabled","label":"Allow biometric authentication","default":true} |
| 29 | + {"type":"autoComplete","name":"standards.EnrollmentWindowsHelloForBusinessConfiguration.enhancedBiometricsState","label":"Use enhanced anti-spoofing when available","multiple":false,"options":[{"label":"Not configured","value":"notConfigured"},{"label":"Enabled","value":"enabled"},{"label":"Disabled","value":"disabled"}]} |
| 30 | + {"type":"switch","name":"standards.EnrollmentWindowsHelloForBusinessConfiguration.remotePassportEnabled","label":"Allow phone sign-in","default":true} |
| 31 | + IMPACT |
| 32 | + Low Impact |
| 33 | + ADDEDDATE |
| 34 | + 2025-09-25 |
| 35 | + POWERSHELLEQUIVALENT |
| 36 | + Graph API |
| 37 | + RECOMMENDEDBY |
| 38 | + UPDATECOMMENTBLOCK |
| 39 | + Run the Tools\Update-StandardsComments.ps1 script to update this comment block |
| 40 | + .LINK |
| 41 | + https://docs.cipp.app/user-documentation/tenant/standards/list-standards |
| 42 | + #> |
| 43 | + |
| 44 | + param($Tenant, $Settings) |
| 45 | + $TestResult = Test-CIPPStandardLicense -StandardName 'EnrollmentWindowsHelloForBusinessConfiguration' -TenantFilter $Tenant -RequiredCapabilities @('INTUNE_A', 'MDM_Services', 'EMS', 'SCCM', 'MICROSOFTINTUNEPLAN1') |
| 46 | + |
| 47 | + if ($TestResult -eq $false) { |
| 48 | + Write-Host "We're exiting as the correct license is not present for this standard." |
| 49 | + return $true |
| 50 | + } #we're done. |
| 51 | + |
| 52 | + try { |
| 53 | + $CurrentState = New-GraphGetRequest -Uri "https://graph.microsoft.com/beta/deviceManagement/deviceEnrollmentConfigurations?`$expand=assignments&orderBy=priority&`$filter=deviceEnrollmentConfigurationType eq 'WindowsHelloForBusiness'" -tenantID $Tenant -AsApp $true | |
| 54 | + Select-Object -Property id, pinMinimumLength, pinMaximumLength, pinUppercaseCharactersUsage, pinLowercaseCharactersUsage, pinSpecialCharactersUsage, state, securityDeviceRequired, unlockWithBiometricsEnabled, remotePassportEnabled, pinPreviousBlockCount, pinExpirationInDays, enhancedBiometricsState |
| 55 | + } |
| 56 | + catch { |
| 57 | + $ErrorMessage = Get-NormalizedError -Message $_.Exception.Message |
| 58 | + Write-LogMessage -API 'Standards' -Tenant $Tenant -Message "Could not get the EnrollmentWindowsHelloForBusinessConfiguration state for $Tenant. Error: $ErrorMessage" -Sev Error |
| 59 | + return |
| 60 | + } |
| 61 | + |
| 62 | + $StateIsCorrect = ($CurrentState.pinMinimumLength -eq $Settings.pinMinimumLength) -and |
| 63 | + ($CurrentState.pinMaximumLength -eq $Settings.pinMaximumLength) -and |
| 64 | + ($CurrentState.pinUppercaseCharactersUsage -eq $Settings.pinUppercaseCharactersUsage.value) -and |
| 65 | + ($CurrentState.pinLowercaseCharactersUsage -eq $Settings.pinLowercaseCharactersUsage.value) -and |
| 66 | + ($CurrentState.pinSpecialCharactersUsage -eq $Settings.pinSpecialCharactersUsage.value) -and |
| 67 | + ($CurrentState.state -eq $Settings.state.value) -and |
| 68 | + ($CurrentState.securityDeviceRequired -eq $Settings.securityDeviceRequired) -and |
| 69 | + ($CurrentState.unlockWithBiometricsEnabled -eq $Settings.unlockWithBiometricsEnabled) -and |
| 70 | + ($CurrentState.remotePassportEnabled -eq $Settings.remotePassportEnabled) -and |
| 71 | + ($CurrentState.pinPreviousBlockCount -eq $Settings.pinPreviousBlockCount) -and |
| 72 | + ($CurrentState.pinExpirationInDays -eq $Settings.pinExpirationInDays) -and |
| 73 | + ($CurrentState.enhancedBiometricsState -eq $Settings.enhancedBiometricsState.value) |
| 74 | + |
| 75 | + $CompareField = [PSCustomObject]@{ |
| 76 | + pinMinimumLength = $CurrentState.pinMinimumLength |
| 77 | + pinMaximumLength = $CurrentState.pinMaximumLength |
| 78 | + pinUppercaseCharactersUsage = $CurrentState.pinUppercaseCharactersUsage |
| 79 | + pinLowercaseCharactersUsage = $CurrentState.pinLowercaseCharactersUsage |
| 80 | + pinSpecialCharactersUsage = $CurrentState.pinSpecialCharactersUsage |
| 81 | + state = $CurrentState.state |
| 82 | + securityDeviceRequired = $CurrentState.securityDeviceRequired |
| 83 | + unlockWithBiometricsEnabled = $CurrentState.unlockWithBiometricsEnabled |
| 84 | + remotePassportEnabled = $CurrentState.remotePassportEnabled |
| 85 | + pinPreviousBlockCount = $CurrentState.pinPreviousBlockCount |
| 86 | + pinExpirationInDays = $CurrentState.pinExpirationInDays |
| 87 | + enhancedBiometricsState = $CurrentState.enhancedBiometricsState |
| 88 | + } |
| 89 | + |
| 90 | + If ($Settings.remediate -eq $true) { |
| 91 | + if ($StateIsCorrect -eq $true) { |
| 92 | + Write-LogMessage -API 'Standards' -Tenant $Tenant -Message 'EnrollmentWindowsHelloForBusinessConfiguration is already applied correctly.' -Sev Info |
| 93 | + } |
| 94 | + else { |
| 95 | + $cmdParam = @{ |
| 96 | + tenantid = $Tenant |
| 97 | + uri = "https://graph.microsoft.com/beta/deviceManagement/deviceEnrollmentConfigurations/$($CurrentState.id)" |
| 98 | + AsApp = $false |
| 99 | + Type = 'PATCH' |
| 100 | + ContentType = 'application/json; charset=utf-8' |
| 101 | + Body = [PSCustomObject]@{ |
| 102 | + "@odata.type" = "#microsoft.graph.deviceEnrollmentWindowsHelloForBusinessConfiguration" |
| 103 | + pinMinimumLength = $Settings.pinMinimumLength |
| 104 | + pinMaximumLength = $Settings.pinMaximumLength |
| 105 | + pinUppercaseCharactersUsage = $Settings.pinUppercaseCharactersUsage.value |
| 106 | + pinLowercaseCharactersUsage = $Settings.pinLowercaseCharactersUsage.value |
| 107 | + pinSpecialCharactersUsage = $Settings.pinSpecialCharactersUsage.value |
| 108 | + state = $Settings.state.value |
| 109 | + securityDeviceRequired = $Settings.securityDeviceRequired |
| 110 | + unlockWithBiometricsEnabled = $Settings.unlockWithBiometricsEnabled |
| 111 | + remotePassportEnabled = $Settings.remotePassportEnabled |
| 112 | + pinPreviousBlockCount = $Settings.pinPreviousBlockCount |
| 113 | + pinExpirationInDays = $Settings.pinExpirationInDays |
| 114 | + enhancedBiometricsState = $Settings.enhancedBiometricsState.value |
| 115 | + } | ConvertTo-Json -Compress -Depth 10 |
| 116 | + } |
| 117 | + try { |
| 118 | + $null = New-GraphPostRequest @cmdParam |
| 119 | + Write-LogMessage -API 'Standards' -Tenant $Tenant -Message 'Successfully updated EnrollmentWindowsHelloForBusinessConfiguration.' -Sev Info |
| 120 | + } |
| 121 | + catch { |
| 122 | + $ErrorMessage = Get-CippException -Exception $_ |
| 123 | + Write-LogMessage -API 'Standards' -Tenant $Tenant -Message "Failed to update EnrollmentWindowsHelloForBusinessConfiguration. Error: $($ErrorMessage.NormalizedError)" -Sev Error |
| 124 | + } |
| 125 | + } |
| 126 | + |
| 127 | + } |
| 128 | + |
| 129 | + If ($Settings.alert -eq $true) { |
| 130 | + if ($StateIsCorrect -eq $true) { |
| 131 | + Write-LogMessage -API 'Standards' -Tenant $Tenant -Message 'EnrollmentWindowsHelloForBusinessConfiguration is correctly set.' -Sev Info |
| 132 | + } |
| 133 | + else { |
| 134 | + Write-StandardsAlert -message 'EnrollmentWindowsHelloForBusinessConfiguration is incorrectly set.' -object $CompareField -tenant $Tenant -standardName 'EnrollmentWindowsHelloForBusinessConfiguration' -standardId $Settings.standardId |
| 135 | + Write-LogMessage -API 'Standards' -Tenant $Tenant -Message 'EnrollmentWindowsHelloForBusinessConfiguration is incorrectly set.' -Sev Info |
| 136 | + } |
| 137 | + } |
| 138 | + |
| 139 | + If ($Settings.report -eq $true) { |
| 140 | + $FieldValue = $StateIsCorrect ? $true : $CompareField |
| 141 | + Set-CIPPStandardsCompareField -FieldName 'standards.EnrollmentWindowsHelloForBusinessConfiguration' -FieldValue $FieldValue -TenantFilter $Tenant |
| 142 | + } |
| 143 | +} |
0 commit comments