Skip to content

Commit b917eec

Browse files
authored
Merge pull request #1668 from KelvinTegelaar/dev
Dev to hotfix
2 parents a7c2997 + 3b917c6 commit b917eec

File tree

10 files changed

+69
-51
lines changed

10 files changed

+69
-51
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListGraphBulkRequest.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ function Invoke-ListGraphBulkRequest {
1313
$NoPaginateIds = $Request.Body.noPaginateIds
1414

1515
$GraphRequestParams = @{
16-
tenantid = $TenantFilter
17-
Requests = @()
16+
tenantid = $TenantFilter
17+
Requests = @()
1818
NoPaginateIds = $NoPaginateIds ?? @()
1919
}
2020

@@ -53,5 +53,5 @@ function Invoke-ListGraphBulkRequest {
5353
}
5454
}
5555

56-
return $Results
56+
return [HttpResponseContext]$Results
5757
}

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-ListExConnectorTemplates.ps1

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,19 @@ function Invoke-ListExConnectorTemplates {
1717
$Filter += " and RowKey eq '$($Request.Query.ID)'"
1818
}
1919

20-
$Templates = (Get-CIPPAzDataTableEntity @Table -Filter $Filter)
20+
$TemplateRows = (Get-CIPPAzDataTableEntity @Table -Filter $Filter)
2121

22-
if ($Templates) {
23-
$Templates | ForEach-Object {
22+
if ($TemplateRows) {
23+
$Templates = $TemplateRows | ForEach-Object {
2424
$GUID = $_.RowKey
2525
$Direction = $_.direction
2626
$data = $_.JSON | ConvertFrom-Json
2727
$data | Add-Member -NotePropertyName 'GUID' -NotePropertyValue $GUID -Force
2828
$data | Add-Member -NotePropertyName 'cippconnectortype' -NotePropertyValue $Direction -Force
2929
$data
3030
} | Sort-Object -Property displayName
31+
} else {
32+
$Templates = @()
3133
}
3234
if ($Request.query.ID) { $Templates = $Templates | Where-Object -Property RowKey -EQ $Request.query.id }
3335

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/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserCounts.ps1

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,26 @@ Function Invoke-ListUserCounts {
5656
# Execute bulk request
5757
$BulkResults = New-GraphBulkRequest -Requests @($BulkRequests) -tenantid $TenantFilter @('Users', 'LicUsers', 'GAs', 'Guests')
5858

59+
# Check if any requests failed
60+
$FailedRequests = $BulkResults | Where-Object { $_.status -ne 200 }
61+
62+
if ($FailedRequests) {
63+
# If any requests failed, return an error response
64+
$FailedIds = ($FailedRequests | ForEach-Object { $_.id }) -join ', '
65+
$ErrorMessage = "Failed to retrieve counts for: $FailedIds"
66+
67+
return ([HttpResponseContext]@{
68+
StatusCode = [HttpStatusCode]::InternalServerError
69+
Body = @{
70+
Error = $ErrorMessage
71+
Details = $FailedRequests
72+
}
73+
})
74+
}
75+
76+
# All requests succeeded, extract the counts
5977
$BulkResults | ForEach-Object {
60-
$Count = if ($_.status -eq 200) {
61-
$_.body.'@odata.count'
62-
} else {
63-
'Not available'
64-
}
78+
$Count = $_.body.'@odata.count'
6579

6680
switch ($_.id) {
6781
'Users' { $Users = $Count }
@@ -72,10 +86,13 @@ Function Invoke-ListUserCounts {
7286
}
7387

7488
} catch {
75-
$Users = 'Not available'
76-
$LicUsers = 'Not available'
77-
$GAs = 'Not available'
78-
$Guests = 'Not available'
89+
# Return error status on exception
90+
return ([HttpResponseContext]@{
91+
StatusCode = [HttpStatusCode]::InternalServerError
92+
Body = @{
93+
Error = "Failed to retrieve user counts: $($_.Exception.Message)"
94+
}
95+
})
7996
}
8097
}
8198

Modules/CIPPCore/Public/New-CIPPGroup.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function New-CIPPGroup {
8585
'displayName' = $GroupObject.displayName
8686
'description' = $GroupObject.description
8787
'mailNickname' = $GroupObject.username
88-
'mailEnabled' = $false
88+
'mailEnabled' = ($NormalizedGroupType -in @('Security', 'M365'))
8989
'securityEnabled' = $true
9090
'isAssignableToRole' = ($NormalizedGroupType -eq 'AzureRole')
9191
}

Modules/CIPPCore/Public/Set-CIPPDefaultAPDeploymentProfile.ps1

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function Set-CIPPDefaultAPDeploymentProfile {
99
$CollectHash,
1010
$UserType,
1111
$DeploymentMode,
12-
$HideChangeAccount,
12+
$HideChangeAccount = $true,
1313
$AssignTo,
1414
$HidePrivacy,
1515
$HideTerms,
@@ -23,26 +23,27 @@ 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"
38-
'escapeLinkHidden' = $([bool]($HideChangeAccount))
37+
'escapeLinkHidden' = $([bool]($true))
3938
'privacySettingsHidden' = $([bool]($HidePrivacy))
4039
'eulaHidden' = $([bool]($HideTerms))
4140
'userType' = "$UserType"
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) {

Modules/CIPPCore/Public/Set-CIPPPerUserMFA.ps1

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,6 @@ function Set-CIPPPerUserMFA {
5353
$Requests = New-GraphBulkRequest -tenantid $TenantFilter -scope 'https://graph.microsoft.com/.default' -Requests @($Requests) -asapp $true
5454
"Successfully set Per user MFA State for $userId"
5555

56-
$Users = foreach ($id in $userId) {
57-
@{
58-
userId = $id
59-
Properties = @{
60-
perUserMfaState = $State
61-
}
62-
}
63-
}
64-
Set-CIPPUserSchemaProperties -TenantFilter $TenantFilter -Users $Users
6556
Write-LogMessage -headers $Headers -API $APIName -message "Successfully set Per user MFA State to $State for $id" -Sev Info -tenant $TenantFilter
6657
} catch {
6758
$ErrorMessage = Get-CippException -Exception $_

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,24 @@ function Invoke-CIPPStandardAutopilotProfile {
5353
$DisplayName = Get-CIPPTextReplacement -Text $Settings.DisplayName -TenantFilter $Tenant
5454

5555
$CurrentConfig = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeploymentProfiles' -tenantid $Tenant |
56-
Where-Object { $_.displayName -eq $DisplayName } |
57-
Select-Object -Property displayName, description, deviceNameTemplate, language, enableWhiteGlove, extractHardwareHash, outOfBoxExperienceSetting, preprovisioningAllowed
56+
Where-Object { $_.displayName -eq $DisplayName } |
57+
Select-Object -Property displayName, description, deviceNameTemplate, locale, preprovisioningAllowed, hardwareHashExtractionEnabled, outOfBoxExperienceSetting
5858

5959
if ($Settings.NotLocalAdmin -eq $true) { $userType = 'Standard' } else { $userType = 'Administrator' }
60-
if ($Settings.SelfDeployingMode -eq $true) { $DeploymentMode = 'shared' } else { $DeploymentMode = 'singleUser' }
61-
if ($Settings.AllowWhiteGlove -eq $true) { $Settings.HideChangeAccount = $true }
60+
if ($Settings.SelfDeployingMode -eq $true) {
61+
$DeploymentMode = 'shared'
62+
$Setings.AllowWhiteGlove = $false
63+
} else {
64+
$DeploymentMode = 'singleUser'
65+
}
6266

6367
$StateIsCorrect = ($CurrentConfig.displayName -eq $DisplayName) -and
6468
($CurrentConfig.description -eq $Settings.Description) -and
6569
($CurrentConfig.deviceNameTemplate -eq $Settings.DeviceNameTemplate) -and
66-
([string]::IsNullOrWhiteSpace($CurrentConfig.language) -and [string]::IsNullOrWhiteSpace($Settings.Languages.value) -or $CurrentConfig.language -eq $Settings.Languages.value) -and
67-
($CurrentConfig.enableWhiteGlove -eq $Settings.AllowWhiteGlove) -and
68-
($CurrentConfig.extractHardwareHash -eq $Settings.CollectHash) -and
70+
([string]::IsNullOrWhiteSpace($CurrentConfig.locale) -and [string]::IsNullOrWhiteSpace($Settings.Languages.value) -or $CurrentConfig.locale -eq $Settings.Languages.value) -and
71+
($CurrentConfig.preprovisioningAllowed -eq $Settings.AllowWhiteGlove) -and
72+
($CurrentConfig.hardwareHashExtractionEnabled -eq $Settings.CollectHash) -and
6973
($CurrentConfig.outOfBoxExperienceSetting.deviceUsageType -eq $DeploymentMode) -and
70-
($CurrentConfig.outOfBoxExperienceSetting.escapeLinkHidden -eq $Settings.HideChangeAccount) -and
7174
($CurrentConfig.outOfBoxExperienceSetting.privacySettingsHidden -eq $Settings.HidePrivacy) -and
7275
($CurrentConfig.outOfBoxExperienceSetting.eulaHidden -eq $Settings.HideTerms) -and
7376
($CurrentConfig.outOfBoxExperienceSetting.userType -eq $userType) -and
@@ -94,7 +97,7 @@ function Invoke-CIPPStandardAutopilotProfile {
9497
devicenameTemplate = $Settings.DeviceNameTemplate
9598
allowWhiteGlove = $Settings.AllowWhiteGlove
9699
CollectHash = $Settings.CollectHash
97-
hideChangeAccount = $Settings.HideChangeAccount
100+
hideChangeAccount = $true
98101
hidePrivacy = $Settings.HidePrivacy
99102
hideTerms = $Settings.HideTerms
100103
AutoKeyboard = $Settings.AutoKeyboard

profile.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ if (!$LastStartup -or $CurrentVersion -ne $LastStartup.Version) {
4343
Write-Information "Version has changed from $($LastStartup.Version ?? 'None') to $CurrentVersion"
4444
if ($LastStartup) {
4545
$LastStartup.Version = $CurrentVersion
46-
$LastStartup | Add-Member -MemberType NoteProperty -Name 'PSVersion' -Value $PSVersionTable.PSVersion.ToString()
46+
$LastStartup | Add-Member -MemberType NoteProperty -Name 'PSVersion' -Value $PSVersionTable.PSVersion.ToString() -Force
4747
} else {
4848
$LastStartup = [PSCustomObject]@{
4949
PartitionKey = 'Version'

version_latest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.5.0
1+
8.5.1

0 commit comments

Comments
 (0)