From 85b2c7366a15a478dbf54a5a34f6de0c98575b18 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Tue, 9 Jul 2024 22:01:35 -0400 Subject: [PATCH] Hudu Improvements Update magic dash buttons Sync more mailbox properties Fix hash check --- .../Private/Hudu/Get-HuduLinkBlock.ps1 | 2 +- .../Sync-CippExtensionData.ps1 | 4 +- .../Public/Hudu/Invoke-HuduExtensionSync.ps1 | 63 ++++++++++++++----- 3 files changed, 52 insertions(+), 17 deletions(-) diff --git a/Modules/CippExtensions/Private/Hudu/Get-HuduLinkBlock.ps1 b/Modules/CippExtensions/Private/Hudu/Get-HuduLinkBlock.ps1 index 5afbaf90de19..69bc48342d06 100644 --- a/Modules/CippExtensions/Private/Hudu/Get-HuduLinkBlock.ps1 +++ b/Modules/CippExtensions/Private/Hudu/Get-HuduLinkBlock.ps1 @@ -1,3 +1,3 @@ function Get-HuduLinkBlock($URL, $Icon, $Title) { - return "" + return '' -f $URL, $Icon, $Title } diff --git a/Modules/CippExtensions/Public/Extension Functions/Sync-CippExtensionData.ps1 b/Modules/CippExtensions/Public/Extension Functions/Sync-CippExtensionData.ps1 index 6a02fdd2c6cb..b815de001bb1 100644 --- a/Modules/CippExtensions/Public/Extension Functions/Sync-CippExtensionData.ps1 +++ b/Modules/CippExtensions/Public/Extension Functions/Sync-CippExtensionData.ps1 @@ -151,14 +151,14 @@ function Sync-CippExtensionData { ) } 'Mailboxes' { - $Select = 'id,ExchangeGuid,ArchiveGuid,UserPrincipalName,DisplayName,PrimarySMTPAddress,RecipientType,RecipientTypeDetails,EmailAddresses,WhenSoftDeleted,IsInactiveMailbox' + $Select = 'id,ExchangeGuid,ArchiveGuid,UserPrincipalName,DisplayName,PrimarySMTPAddress,RecipientType,RecipientTypeDetails,EmailAddresses,WhenSoftDeleted,IsInactiveMailbox,ProhibitSendQuota,ProhibitSendReceiveQuota,LitigationHoldEnabled,InPlaceHolds,HiddenFromAddressListsEnabled' $ExoRequest = @{ tenantid = $TenantFilter cmdlet = 'Get-Mailbox' cmdParams = @{} Select = $Select } - $Mailboxes = (New-ExoRequest @ExoRequest) | Select-Object id, ExchangeGuid, ArchiveGuid, WhenSoftDeleted, @{ Name = 'UPN'; Expression = { $_.'UserPrincipalName' } }, + $Mailboxes = (New-ExoRequest @ExoRequest) | Select-Object id, ExchangeGuid, ArchiveGuid, WhenSoftDeleted, ProhibitSendQuota, ProhibitSendReceiveQuota, LitigationHoldEnabled, InplaceHolds, HiddenFromAddressListsEnabled, @{ Name = 'UPN'; Expression = { $_.'UserPrincipalName' } }, @{ Name = 'displayName'; Expression = { $_.'DisplayName' } }, @{ Name = 'primarySmtpAddress'; Expression = { $_.'PrimarySMTPAddress' } }, diff --git a/Modules/CippExtensions/Public/Hudu/Invoke-HuduExtensionSync.ps1 b/Modules/CippExtensions/Public/Hudu/Invoke-HuduExtensionSync.ps1 index 80f92e6ad662..9ce6079934d1 100644 --- a/Modules/CippExtensions/Public/Hudu/Invoke-HuduExtensionSync.ps1 +++ b/Modules/CippExtensions/Public/Hudu/Invoke-HuduExtensionSync.ps1 @@ -70,15 +70,44 @@ function Invoke-HuduExtensionSync { $HuduDevices = $HuduDesktopDevices - $CustomerLinks = "
-
-
-
-
-
-
-
" + $Links = @( + @{ + Title = 'M365 Admin Portal' + URL = 'https://admin.microsoft.com/Partner/BeginClientSession.aspx?CTID={0}&CSDEST=o365admincenter' -f $Tenant.customerId + Icon = 'fas fa-cogs' + } + @{ + Title = 'Exchange Admin Portal' + URL = 'https://outlook.office365.com/ecp/?rfr=Admin_o365&exsvurl=1&delegatedOrg={0}' -f $Tenant.initialDomainName + Icon = 'fas fa-mail-bulk' + } + @{ + Title = 'Entra Portal' + URL = 'https://entra.microsoft.com/{0}' -f $Tenant.defaultDomainName + Icon = 'fas fa-users-cog' + } + @{ + Title = 'Intune' + URL = 'https://intune.microsoft.com/{0}/' -f $Tenant.defaultDomainName + Icon = 'fas fa-laptop' + } + @{ + Title = 'Teams Portal' + URL = 'https://admin.teams.microsoft.com/?delegatedOrg={0}' -f $Tenant.defaultDomainName + Icon = 'fas fa-users' + } + @{ + Title = 'Azure Portal' + URL = 'https://portal.azure.com/{0}' -f $Tenant.defaultDomainName + Icon = 'fas fa-server' + } + ) + $FormattedLinks = foreach ($Link in $Links) { + Get-HuduLinkBlock @Link + } + + $CustomerLinks = $FormattedLinks -join "`n" #$Users = Get-BulkResultByID -Results $TenantResults -ID 'Users' $Users = $ExtensionCache.Users @@ -335,7 +364,13 @@ function Invoke-HuduExtensionSync { $CompanyResult.Errors.add("Company: Unable to fetch Mailbox Details $_") $MailboxDetailedFull = $null }#> - $MailboxDetailedFull = $ExtensionCache.Mailboxes + + if ($ExtensionCache.Mailboxes) { + $MailboxDetailedFull = $ExtensionCache.Mailboxes + } else { + $CompanyResult.Errors.add('Company: Unable to fetch Mailbox Details') + $MailboxDetailedFull = $null + } <#try { @@ -389,8 +424,8 @@ function Invoke-HuduExtensionSync { $MailboxDetailedRequest = '' $CASRequest = '' - $CASRequest = $CASFull | Where-Object { $_.ExternalDirectoryObjectId -eq $User.iD } - $MailboxDetailedRequest = $MailboxDetailedFull | Where-Object { $_.ExternalDirectoryObjectId -eq $User.iD } + $CASRequest = $CASFull | Where-Object { $_.ExternalDirectoryObjectId -eq $User.id } + $MailboxDetailedRequest = $MailboxDetailedFull | Where-Object { $_.Id -eq $User.id } $StatsRequest = $MailboxStatsFull | Where-Object { $_.'userPrincipalName' -eq $User.UserPrincipalName } <#try { @@ -638,7 +673,7 @@ function Invoke-HuduExtensionSync { $HuduUserCount = ($HuduUser | Measure-Object).count if ($HuduUserCount -eq 1) { - $ExistingAsset = Get-CIPPAzDataTableEntity @HuduAssetCache -Filter "PartitionKey eq 'HuduUser' and CompanyId eq $company_id and RowKey eq '$($HuduUser.id)'" + $ExistingAsset = Get-CIPPAzDataTableEntity @HuduAssetCache -Filter "PartitionKey eq 'HuduUser' and CompanyId eq '$company_id' and RowKey eq '$($HuduUser.id)'" $ExistingHash = $ExistingAsset.Hash if (!$ExistingAsset -or $ExistingHash -ne $NewHash) { @@ -797,7 +832,7 @@ function Invoke-HuduExtensionSync { if ($HuduDevice) { if (($HuduDevice | Measure-Object).count -eq 1) { - $ExistingAsset = Get-CIPPAzDataTableEntity @HuduAssetCache -Filter "PartitionKey eq 'HuduDevice' and CompanyId eq $company_id and RowKey eq '$($HuduDevice.id)'" + $ExistingAsset = Get-CIPPAzDataTableEntity @HuduAssetCache -Filter "PartitionKey eq 'HuduDevice' and CompanyId eq '$company_id' and RowKey eq '$($HuduDevice.id)'" $ExistingHash = $ExistingAsset.Hash if (!$ExistingAsset -or $ExistingAsset.Hash -ne $NewHash) { @@ -864,7 +899,7 @@ function Invoke-HuduExtensionSync {

Administrative Portals

-
$CustomerLinks
+
$CustomerLinks