Skip to content

Commit 5763997

Browse files
authored
Merge pull request #444 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents e2210a3 + 1f3fc8f commit 5763997

File tree

4 files changed

+45
-33
lines changed

4 files changed

+45
-33
lines changed
Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using namespace System.Net
22

3-
Function Invoke-AddEnrollment {
3+
function Invoke-AddEnrollment {
44
<#
55
.FUNCTIONALITY
66
Entrypoint
@@ -14,22 +14,29 @@ Function Invoke-AddEnrollment {
1414
$Headers = $Request.Headers
1515
Write-LogMessage -headers $Headers -API $APIName -message 'Accessed this API' -Sev 'Debug'
1616

17-
18-
19-
2017
# Input bindings are passed in via param block.
21-
$Tenants = $Request.body.selectedTenants.value
22-
$Profbod = $Request.body
23-
$results = foreach ($Tenant in $tenants) {
24-
Set-CIPPDefaultAPEnrollment -TenantFilter $Tenant -ShowProgress $Profbod.ShowProgress -BlockDevice $Profbod.blockDevice -AllowReset $Profbod.AllowReset -EnableLog $Profbod.EnableLog -ErrorMessage $Profbod.ErrorMessage -TimeOutInMinutes $Profbod.TimeOutInMinutes -AllowFail $Profbod.AllowFail -OBEEOnly $Profbod.OBEEOnly
18+
$Tenants = $Request.Body.selectedTenants.value
19+
$Profbod = $Request.Body
20+
$Results = foreach ($Tenant in $Tenants) {
21+
$ParamSplat = @{
22+
TenantFilter = $Tenant
23+
ShowProgress = $Profbod.ShowProgress
24+
BlockDevice = $Profbod.blockDevice
25+
AllowReset = $Profbod.AllowReset
26+
EnableLog = $Profbod.EnableLog
27+
ErrorMessage = $Profbod.ErrorMessage
28+
TimeOutInMinutes = $Profbod.TimeOutInMinutes
29+
AllowFail = $Profbod.AllowFail
30+
OBEEOnly = $Profbod.OBEEOnly
31+
InstallWindowsUpdates = $Profbod.InstallWindowsUpdates
32+
}
33+
Set-CIPPDefaultAPEnrollment @ParamSplat
2534
}
2635

27-
$body = [pscustomobject]@{'Results' = $results }
28-
2936
# Associate values to output bindings by calling 'Push-OutputBinding'.
3037
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
3138
StatusCode = [HttpStatusCode]::OK
32-
Body = $body
39+
Body = @{'Results' = $Results }
3340
})
3441

3542
}

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using namespace System.Net
22

3-
Function Invoke-ListAutopilotconfig {
3+
function Invoke-ListAutopilotconfig {
44
<#
55
.FUNCTIONALITY
66
Entrypoint
@@ -15,18 +15,16 @@ Function Invoke-ListAutopilotconfig {
1515
Write-LogMessage -headers $Headers -API $APIName -message 'Accessed this API' -Sev 'Debug'
1616

1717

18-
19-
2018
# Interact with query parameters or the body of the request.
2119
$TenantFilter = $Request.Query.TenantFilter
22-
$userid = $Request.Query.UserID
2320
try {
24-
if ($request.query.type -eq 'ApProfile') {
21+
if ($Request.Query.type -eq 'ApProfile') {
2522
$GraphRequest = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeploymentProfiles?`$expand=assignments" -tenantid $TenantFilter
2623
}
2724

28-
if ($request.query.type -eq 'ESP') {
29-
$GraphRequest = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/deviceManagement/deviceEnrollmentConfigurations?`$expand=assignments" -tenantid $TenantFilter | Where-Object -Property '@odata.type' -EQ '#microsoft.graph.windows10EnrollmentCompletionPageConfiguration'
25+
if ($Request.Query.type -eq 'ESP') {
26+
$GraphRequest = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/deviceManagement/deviceEnrollmentConfigurations?`$expand=assignments" -tenantid $TenantFilter |
27+
Where-Object -Property '@odata.type' -EQ '#microsoft.graph.windows10EnrollmentCompletionPageConfiguration'
3028
}
3129
$StatusCode = [HttpStatusCode]::OK
3230
} catch {

Modules/CIPPCore/Public/Set-CIPPDefaultAPEnrollment.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ function Set-CIPPDefaultAPEnrollment {
88
$EnableLog,
99
$ErrorMessage,
1010
$TimeOutInMinutes,
11+
$InstallWindowsUpdates,
1112
$AllowFail,
1213
$OBEEOnly,
1314
$Headers,
1415
$APIName = 'Add Default Enrollment Status Page'
1516
)
1617

17-
$User = $Request.Headers
18-
1918
try {
2019
$ObjBody = [pscustomobject]@{
2120
'@odata.type' = '#microsoft.graph.windows10EnrollmentCompletionPageConfiguration'
@@ -28,6 +27,7 @@ function Set-CIPPDefaultAPEnrollment {
2827
'allowLogCollectionOnInstallFailure' = [bool]$EnableLog
2928
'customErrorMessage' = "$ErrorMessage"
3029
'installProgressTimeoutInMinutes' = $TimeOutInMinutes
30+
'installQualityUpdates' = [bool]$InstallWindowsUpdates
3131
'allowDeviceUseOnInstallFailure' = [bool]$AllowFail
3232
'selectedMobileAppIds' = @()
3333
'trackInstallProgressForAutopilotOnly' = [bool]$OBEEOnly
@@ -40,11 +40,11 @@ function Set-CIPPDefaultAPEnrollment {
4040
if ($PSCmdlet.ShouldProcess($ExistingStatusPage.ID, 'Set Default Enrollment Status Page')) {
4141
$null = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/deviceEnrollmentConfigurations/$($ExistingStatusPage.ID)" -body $Body -Type PATCH -tenantid $TenantFilter
4242
"Successfully changed default enrollment status page for $TenantFilter"
43-
Write-LogMessage -Headers $User -API $APIName -tenant $TenantFilter -message "Added Autopilot Enrollment Status Page $($ExistingStatusPage.displayName)" -Sev 'Info'
43+
Write-LogMessage -Headers $Headers -API $APIName -tenant $TenantFilter -message "Added Autopilot Enrollment Status Page $($ExistingStatusPage.displayName)" -Sev 'Info'
4444
}
4545
} catch {
4646
$ErrorMessage = Get-CippException -Exception $_
47-
Write-LogMessage -Headers $User -API $APIName -tenant $TenantFilter -message "Failed adding Autopilot Enrollment Status Page $($ExistingStatusPage.displayName). Error: $($ErrorMessage.NormalizedError)" -Sev 'Error' -LogData $ErrorMessage
47+
Write-LogMessage -Headers $Headers -API $APIName -tenant $TenantFilter -message "Failed adding Autopilot Enrollment Status Page $($ExistingStatusPage.displayName). Error: $($ErrorMessage.NormalizedError)" -Sev 'Error' -LogData $ErrorMessage
4848
throw "Failed to change default enrollment status page for $($TenantFilter): $($ErrorMessage.NormalizedError)"
4949
}
5050
}

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardAutopilotStatusPage.ps1

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ function Invoke-CIPPStandardAutopilotStatusPage {
1515
TAG
1616
DISABLEDFEATURES
1717
{"report":false,"warn":false,"remediate":false}
18+
EXECUTIVETEXT
19+
Provides employees with a visual progress indicator during automated device setup, improving the user experience when receiving new computers. This reduces IT support calls and helps ensure successful device deployment by guiding users through the setup process.
1820
ADDEDCOMPONENT
1921
{"type":"number","name":"standards.AutopilotStatusPage.TimeOutInMinutes","label":"Timeout in minutes","defaultValue":60}
2022
{"type":"textField","name":"standards.AutopilotStatusPage.ErrorMessage","label":"Custom Error Message","required":false}
2123
{"type":"switch","name":"standards.AutopilotStatusPage.ShowProgress","label":"Show progress to users","defaultValue":true}
2224
{"type":"switch","name":"standards.AutopilotStatusPage.EnableLog","label":"Turn on log collection","defaultValue":true}
2325
{"type":"switch","name":"standards.AutopilotStatusPage.OBEEOnly","label":"Show status page only with OOBE setup","defaultValue":true}
26+
{"type":"switch","name":"standards.AutopilotStatusPage.InstallWindowsUpdates","label":"Install Windows Updates during setup","defaultValue":true}
2427
{"type":"switch","name":"standards.AutopilotStatusPage.BlockDevice","label":"Block device usage during setup","defaultValue":true}
25-
{"type":"switch","name":"standards.AutopilotStatusPage.AllowRetry","label":"Allow retry","defaultValue":true}
2628
{"type":"switch","name":"standards.AutopilotStatusPage.AllowReset","label":"Allow reset","defaultValue":true}
2729
{"type":"switch","name":"standards.AutopilotStatusPage.AllowFail","label":"Allow users to use device if setup fails","defaultValue":true}
2830
IMPACT
@@ -46,14 +48,18 @@ function Invoke-CIPPStandardAutopilotStatusPage {
4648
} #we're done.
4749
try {
4850
$CurrentConfig = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/deviceManagement/deviceEnrollmentConfigurations?`$expand=assignments&orderBy=priority&`$filter=deviceEnrollmentConfigurationType eq 'windows10EnrollmentCompletionPageConfiguration' and priority eq 0" -tenantid $Tenant |
49-
Select-Object -Property id, displayName, priority, showInstallationProgress, blockDeviceSetupRetryByUser, allowDeviceResetOnInstallFailure, allowLogCollectionOnInstallFailure, customErrorMessage, installProgressTimeoutInMinutes, allowDeviceUseOnInstallFailure, trackInstallProgressForAutopilotOnly
51+
Select-Object -Property id, displayName, priority, showInstallationProgress, blockDeviceSetupRetryByUser, allowDeviceResetOnInstallFailure, allowLogCollectionOnInstallFailure, customErrorMessage, installProgressTimeoutInMinutes, allowDeviceUseOnInstallFailure, trackInstallProgressForAutopilotOnly, installQualityUpdates
52+
53+
# Compatibility for standards made in v8.3.0 or before, which did not have the InstallWindowsUpdates setting
54+
$InstallWindowsUpdates = $Settings.InstallWindowsUpdates ?? $false
5055

5156
$StateIsCorrect = ($CurrentConfig.installProgressTimeoutInMinutes -eq $Settings.TimeOutInMinutes) -and
5257
($CurrentConfig.customErrorMessage -eq $Settings.ErrorMessage) -and
5358
($CurrentConfig.showInstallationProgress -eq $Settings.ShowProgress) -and
5459
($CurrentConfig.allowLogCollectionOnInstallFailure -eq $Settings.EnableLog) -and
5560
($CurrentConfig.trackInstallProgressForAutopilotOnly -eq $Settings.OBEEOnly) -and
5661
($CurrentConfig.blockDeviceSetupRetryByUser -eq !$Settings.BlockDevice) -and
62+
($CurrentConfig.installQualityUpdates -eq $InstallWindowsUpdates) -and
5763
($CurrentConfig.allowDeviceResetOnInstallFailure -eq $Settings.AllowReset) -and
5864
($CurrentConfig.allowDeviceUseOnInstallFailure -eq $Settings.AllowFail)
5965
} catch {
@@ -66,15 +72,16 @@ function Invoke-CIPPStandardAutopilotStatusPage {
6672
if ($Settings.remediate -eq $true) {
6773
try {
6874
$Parameters = @{
69-
TenantFilter = $Tenant
70-
ShowProgress = $Settings.ShowProgress
71-
BlockDevice = $Settings.BlockDevice
72-
AllowReset = $Settings.AllowReset
73-
EnableLog = $Settings.EnableLog
74-
ErrorMessage = $Settings.ErrorMessage
75-
TimeOutInMinutes = $Settings.TimeOutInMinutes
76-
AllowFail = $Settings.AllowFail
77-
OBEEOnly = $Settings.OBEEOnly
75+
TenantFilter = $Tenant
76+
ShowProgress = $Settings.ShowProgress
77+
BlockDevice = $Settings.BlockDevice
78+
InstallWindowsUpdates = $InstallWindowsUpdates
79+
AllowReset = $Settings.AllowReset
80+
EnableLog = $Settings.EnableLog
81+
ErrorMessage = $Settings.ErrorMessage
82+
TimeOutInMinutes = $Settings.TimeOutInMinutes
83+
AllowFail = $Settings.AllowFail
84+
OBEEOnly = $Settings.OBEEOnly
7885
}
7986

8087
Set-CIPPDefaultAPEnrollment @Parameters

0 commit comments

Comments
 (0)