Skip to content

Commit 4d2cd96

Browse files
authored
Merge branch 'KelvinTegelaar:master' into master
2 parents edd130d + f8a29d4 commit 4d2cd96

456 files changed

Lines changed: 28604 additions & 3492 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ Logs
99
ExcludedTenants
1010
SendNotifications/config.json
1111
.env
12+
13+
14+
# Cursor IDE
15+
.cursor/rules

AddMSPApp/datto.app.xml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
<ApplicationInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ToolVersion="1.8.3.0">
2-
<Name>install.ps1</Name>
3-
<UnencryptedContentSize>705</UnencryptedContentSize>
4-
<FileName>datto.intunewin</FileName>
5-
<SetupFile>install.ps1</SetupFile>
6-
<EncryptionInfo>
7-
<EncryptionKey>sL/LP/JZ4F4cBSykm6usgJoV1PMoqd62C6JUwuo2z24=</EncryptionKey>
8-
<MacKey>PEpeqeoX7jAWxb0xHGfCkKFxh4/YRfoMTVXrP+uZWzM=</MacKey>
9-
<InitializationVector>ulFPA+vYjaxX0pvq0BMAKQ==</InitializationVector>
10-
<Mac>28ZFU4AT1OznwF8pfqO8i+WFUNSf9024H4Jw2H7UJWs=</Mac>
11-
<ProfileIdentifier>ProfileVersion1</ProfileIdentifier>
12-
<FileDigest>YEb+QNQCko/uZyedA+JfcP/RDm+nZOIjFN04CfhwN4c=</FileDigest>
13-
<FileDigestAlgorithm>SHA256</FileDigestAlgorithm>
14-
</EncryptionInfo>
1+
<ApplicationInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ToolVersion="1.8.3.0">
2+
<Name>install.ps1</Name>
3+
<UnencryptedContentSize>693</UnencryptedContentSize>
4+
<FileName>datto.intunewin</FileName>
5+
<SetupFile>install.ps1</SetupFile>
6+
<EncryptionInfo>
7+
<EncryptionKey>jobB9Ga7J3CbO6acWJyvBRE56nFXwqGfcnGfZRMsJC4=</EncryptionKey>
8+
<MacKey>53SOzs0l6Po2btsGFSMZgkV8vwhH+PxTN8BZDUcfWfg=</MacKey>
9+
<InitializationVector>VjM/osrvPElbu79J+mdXuw==</InitializationVector>
10+
<Mac>UZZXO53Np/tG6Ms+qvwLcNOeD1GRH6NRPFg/TuMz39M=</Mac>
11+
<ProfileIdentifier>ProfileVersion1</ProfileIdentifier>
12+
<FileDigest>KtAWAl29064LG0eyDinbDs0JUbK+EK7GsJovu8obBM4=</FileDigest>
13+
<FileDigestAlgorithm>SHA256</FileDigestAlgorithm>
14+
</EncryptionInfo>
1515
</ApplicationInfo>

AddMSPApp/datto.intunewin

-16 Bytes
Binary file not shown.

CIPP-Permissions.json

Lines changed: 804 additions & 0 deletions
Large diffs are not rendered by default.

CIPPTimers.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,13 @@
8181
"PreferredProcessor": "standards"
8282
},
8383
{
84-
"Id": "5113c66d-c040-42df-9565-39dff90ddd55",
85-
"Command": "Start-CIPPGraphSubscriptionCleanupTimer",
86-
"Description": "Orchestrator to cleanup old Graph subscriptions",
87-
"Cron": "0 0 0 * * *",
84+
"Id": "4d80205c-674d-4fc1-abeb-a1ec37e0d796",
85+
"Command": "Start-DriftStandardsOrchestrator",
86+
"Description": "Orchestrator to process drift standards",
87+
"Cron": "0 0 */1 * * *",
8888
"Priority": 5,
89-
"RunOnProcessor": true
89+
"RunOnProcessor": true,
90+
"PreferredProcessor": "standards"
9091
},
9192
{
9293
"Id": "97145a1d-28f0-4bb2-b929-5a43517d23cc",
@@ -205,4 +206,4 @@
205206
"RunOnProcessor": true,
206207
"IsSystem": true
207208
}
208-
]
209+
]

Config/standards.json

Lines changed: 1068 additions & 115 deletions
Large diffs are not rendered by default.

ConversionTable.csv

Lines changed: 267 additions & 98 deletions
Large diffs are not rendered by default.
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
function Add-CIPPAlias {
22
[CmdletBinding()]
33
param (
4-
$user,
4+
$User,
55
$Aliases,
6-
$UserprincipalName,
6+
$UserPrincipalName,
77
$TenantFilter,
8-
$APIName = 'Set Manager',
8+
$APIName = 'Add Alias',
99
$Headers
1010
)
1111

1212
try {
1313
foreach ($Alias in $Aliases) {
14-
Write-Host "Adding alias $Alias to $user"
15-
New-GraphPostRequest -uri "https://graph.microsoft.com/beta/users/$user" -tenantid $TenantFilter -type 'patch' -body "{`"mail`": `"$Alias`"}" -verbose
14+
Write-Host "Adding alias $Alias to $User"
15+
New-GraphPostRequest -uri "https://graph.microsoft.com/beta/users/$User" -tenantid $TenantFilter -type 'patch' -body "{`"mail`": `"$Alias`"}" -verbose
1616
}
1717
Write-Host "Resetting primary alias to $User"
18-
New-GraphPostRequest -uri "https://graph.microsoft.com/beta/users/$($user)" -tenantid $TenantFilter -type 'patch' -body "{`"mail`": `"$User`"}" -verbose
19-
Write-LogMessage -headers $Headers -API $APINAME -tenant $($TenantFilter) -message "Added alias $($Alias) to $($UserprincipalName)" -Sev 'Info'
18+
New-GraphPostRequest -uri "https://graph.microsoft.com/beta/users/$User" -tenantid $TenantFilter -type 'patch' -body "{`"mail`": `"$User`"}" -verbose
19+
Write-LogMessage -headers $Headers -API $APIName -tenant $($TenantFilter) -message "Added alias $($Alias) to $($UserPrincipalName)" -Sev 'Info'
2020
return ("Added Aliases: $($Aliases -join ',')")
2121
} catch {
22-
Write-LogMessage -headers $Headers -API $APINAME -tenant $($TenantFilter) -message "Failed to set alias. Error:$($_.Exception.Message)" -Sev 'Error'
23-
throw "Failed to set alias: $($_.Exception.Message)"
22+
$ErrorMessage = Get-CippException -Exception $_
23+
Write-LogMessage -headers $Headers -API $APIName -tenant $($TenantFilter) -message "Failed to set alias. Error:$($ErrorMessage.NormalizedError)" -Sev 'Error' -LogData $ErrorMessage
24+
throw "Failed to set alias: $($ErrorMessage.NormalizedError)"
2425
}
2526
}
2627

Modules/CIPPCore/Public/Add-CIPPDelegatedPermission.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ function Add-CIPPDelegatedPermission {
114114
$OldScope = ($CurrentDelegatedScopes | Where-Object -Property Resourceid -EQ $svcPrincipalId.id)
115115

116116
if (!$OldScope) {
117+
if ([string]::IsNullOrEmpty($NewScope) -or $NewScope -eq ' ') {
118+
$Results.add("No delegated permissions to add for $($svcPrincipalId.displayName)")
119+
continue
120+
}
117121
try {
118122
$Createbody = @{
119123
clientId = $ourSVCPrincipal.id
@@ -147,6 +151,13 @@ function Add-CIPPDelegatedPermission {
147151
$Results.add("All delegated permissions exist for $($svcPrincipalId.displayName)")
148152
continue
149153
}
154+
155+
if ([string]::IsNullOrEmpty($NewScope) -or $NewScope -eq ' ') {
156+
# No permissions to update
157+
$Results.add("No delegated permissions to update for $($svcPrincipalId.displayName)")
158+
continue
159+
}
160+
150161
$Patchbody = @{
151162
scope = "$NewScope"
152163
} | ConvertTo-Json -Compress

Modules/CIPPCore/Public/Add-CIPPGroupMember.ps1

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,22 @@ function Add-CIPPGroupMember(
77
[string]$APIName = 'Add Group Member'
88
) {
99
try {
10-
if ($member -like '*#EXT#*') { $member = [System.Web.HttpUtility]::UrlEncode($member) }
11-
$MemberIDs = 'https://graph.microsoft.com/v1.0/directoryObjects/' + (New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users/$($member)" -tenantid $TenantFilter).id
12-
$addmemberbody = "{ `"members@odata.bind`": $(ConvertTo-Json @($MemberIDs)) }"
10+
if ($Member -like '*#EXT#*') { $Member = [System.Web.HttpUtility]::UrlEncode($Member) }
11+
$MemberIDs = 'https://graph.microsoft.com/v1.0/directoryObjects/' + (New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users/$($Member)" -tenantid $TenantFilter).id
12+
$AddMemberBody = "{ `"members@odata.bind`": $(ConvertTo-Json @($MemberIDs)) }"
1313
if ($GroupType -eq 'Distribution list' -or $GroupType -eq 'Mail-Enabled Security') {
14-
$Params = @{ Identity = $GroupId; Member = $member; BypassSecurityGroupManagerCheck = $true }
15-
$null = New-ExoRequest -tenantid $TenantFilter -cmdlet 'Add-DistributionGroupMember' -cmdParams $params -UseSystemMailbox $true
14+
$Params = @{ Identity = $GroupId; Member = $Member; BypassSecurityGroupManagerCheck = $true }
15+
$null = New-ExoRequest -tenantid $TenantFilter -cmdlet 'Add-DistributionGroupMember' -cmdParams $Params -UseSystemMailbox $true
1616
} else {
17-
$null = New-GraphPostRequest -uri "https://graph.microsoft.com/beta/groups/$($GroupId)" -tenantid $TenantFilter -type patch -body $addmemberbody -Verbose
17+
$null = New-GraphPostRequest -uri "https://graph.microsoft.com/beta/groups/$($GroupId)" -tenantid $TenantFilter -type patch -body $AddMemberBody -Verbose
1818
}
19-
$Message = "Successfully added user $($Member) to $($GroupId)."
20-
Write-LogMessage -headers $Headers -API $APIName -tenant $TenantFilter -message $Message -Sev 'Info'
21-
return $message
19+
$Results = "Successfully added user $($Member) to $($GroupId)."
20+
Write-LogMessage -headers $Headers -API $APIName -tenant $TenantFilter -message $Results -Sev 'Info'
21+
return $Results
2222
} catch {
23-
$message = "Failed to add user $($Member) to $($GroupId) - $($_.Exception.Message)"
24-
Write-LogMessage -headers $Headers -API $APIName -tenant $TenantFilter -message $message -Sev 'error' -LogData (Get-CippException -Exception $_)
25-
return $message
23+
$ErrorMessage = Get-CippException -Exception $_
24+
$Results = "Failed to add user $($Member) to $($GroupId) - $($ErrorMessage.NormalizedError)"
25+
Write-LogMessage -headers $Headers -API $APIName -tenant $TenantFilter -message $Results -Sev 'error' -LogData $ErrorMessage
26+
throw $Results
2627
}
2728
}

0 commit comments

Comments
 (0)