Skip to content

Commit f65dc6d

Browse files
committed
autopilot tweaks
1 parent 65ce13f commit f65dc6d

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/Autopilot/Invoke-AddAutopilotConfig.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@ function Invoke-AddAutopilotConfig {
1212
$Profbod = [pscustomobject]$Request.Body
1313
$UserType = if ($Profbod.NotLocalAdmin -eq 'true') { 'standard' } else { 'administrator' }
1414
$DeploymentMode = if ($Profbod.DeploymentMode -eq 'true') { 'shared' } else { 'singleUser' }
15+
16+
# If deployment mode is shared, disable white glove (pre-provisioning) as it's not supported
17+
$AllowWhiteGlove = if ($DeploymentMode -eq 'shared') { $false } else { $Profbod.allowWhiteGlove }
18+
1519
$profileParams = @{
1620
DisplayName = $Request.Body.DisplayName
1721
Description = $Request.Body.Description
1822
UserType = $UserType
1923
DeploymentMode = $DeploymentMode
2024
AssignTo = $Request.Body.Assignto
2125
DeviceNameTemplate = $Profbod.DeviceNameTemplate
22-
AllowWhiteGlove = $Profbod.allowWhiteGlove
26+
AllowWhiteGlove = $AllowWhiteGlove
2327
CollectHash = $Profbod.CollectHash
2428
HideChangeAccount = $Profbod.HideChangeAccount
2529
HidePrivacy = $Profbod.HidePrivacy

Modules/CIPPCore/Public/Set-CIPPDefaultAPDeploymentProfile.ps1

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,16 @@ function Set-CIPPDefaultAPDeploymentProfile {
2323

2424
try {
2525
$ObjBody = [pscustomobject]@{
26-
'@odata.type' = '#microsoft.graph.azureADWindowsAutopilotDeploymentProfile'
27-
'displayName' = "$($DisplayName)"
28-
'description' = "$($Description)"
29-
'deviceNameTemplate' = "$($DeviceNameTemplate)"
30-
'language' = "$($Language)"
31-
'enableWhiteGlove' = $([bool]($AllowWhiteGlove))
32-
'deviceType' = 'windowsPc'
33-
'extractHardwareHash' = $([bool]($CollectHash))
34-
'roleScopeTagIds' = @()
35-
'hybridAzureADJoinSkipConnectivityCheck' = $false
36-
'outOfBoxExperienceSetting' = @{
26+
'@odata.type' = '#microsoft.graph.azureADWindowsAutopilotDeploymentProfile'
27+
'displayName' = "$($DisplayName)"
28+
'description' = "$($Description)"
29+
'deviceNameTemplate' = "$($DeviceNameTemplate)"
30+
'locale' = "$($Language ?? 'os-default')"
31+
'preprovisioningAllowed' = $([bool]($AllowWhiteGlove))
32+
'deviceType' = 'windowsPc'
33+
'hardwareHashExtractionEnabled' = $([bool]($CollectHash))
34+
'roleScopeTagIds' = @()
35+
'outOfBoxExperienceSetting' = @{
3736
'deviceUsageType' = "$DeploymentMode"
3837
'escapeLinkHidden' = $([bool]($HideChangeAccount))
3938
'privacySettingsHidden' = $([bool]($HidePrivacy))
@@ -42,7 +41,9 @@ function Set-CIPPDefaultAPDeploymentProfile {
4241
'keyboardSelectionPageSkipped' = $([bool]($AutoKeyboard))
4342
}
4443
}
45-
$Body = ConvertTo-Json -InputObject $ObjBody
44+
$Body = ConvertTo-Json -InputObject $ObjBody -Depth 10
45+
46+
Write-Information $Body
4647

4748
$Profiles = New-GraphGETRequest -uri 'https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeploymentProfiles' -tenantid $TenantFilter | Where-Object -Property displayName -EQ $DisplayName
4849
if ($Profiles.count -gt 1) {

0 commit comments

Comments
 (0)