0 votes

We have the following script we need fixed to run within Adaxes to add true/false value to a customattribute for use in building dynamic distribution lists.

$users = Get-User -RecipientTypeDetails UserMailbox
foreach($user in $users)
{
if($user.DirectReports)
{
Set-Mailbox -Identity $user.Name -CustomAttribute8 Manager
}
else
{
Set-Mailbox -Identity $user.Name -CustomAttribute8 "Individual contributor"
}
}
by (3.2k points)
0

Hello,

For us to help you with a solution, please, specify the following:

  • What exactly do you eman by add true/false? We do not see that in your current script.
  • Do you need the script to be executed on a regular basis to make sure that users have corresponding attribute value depending on their mailbox type and Direct Reports presence? If that is correct, should the attribute be cleared if not empty and the user does not meet any of the conditions?
  • Do users have mailboxes in Exchange Online only?

Any additional information will be much appreciated.

0

sorry, the true/false is not a requirement any longer (change of plans) if we can just get this script Adaxes-ized to run it will fulfill the requirements the business gave us.

I will be making a scheduled task to run daily

Yes they should have on prem mailboxes synced to cloud.

1 Answer

0 votes
by (292k points)

Hello,

Thank you for clarifying. In this case, you do not need to use scripts. The scheduled task will look like the following:

image.png

0

Thank you, this worked flawlessly for one domain in scope but not another. I did select All Objects and exclude deprovisioned objects. Please advise as to what to check.

Please note: the ones that were successful were on prem Exchnage users syncing to O365 and the ones that failed are online only.

0

Hello,

What exactly do you mean by the ones that failed are online only? Are they on-premises AD uses not synchronized to Microsoft 365 with mailboxes in Exchange Online? Are they cloud-only objects?

0

we have a hybrid environemnt, one doomain has on prem AD and Exchange and sync to Azure/m365. They were successful. One domain has on prem AD and NO exchange and only Exchange Online, these all failed.

0

Hello,

Thank you for clarifying. In case when all users have mailboxes in Exchange Online (it is the case for remote mailboxes as well), you need to use a different approach. To achieve the desired, replace the condition for the Recipient Type Details property in the first action set with the following script:

$Context.ConditionIsMet = $Context.TargetObject.MailboxType -eq "ADM_EXCHANGE_MAILBOXTYPE_USER" -and `
    $Context.TargetObject.RecipientLocation -eq "ADM_EXCHANGERECIPIENTLOCATION_OFFICE365"

In the second action set, replace the condition with the following script:

$Context.ConditionIsMet = -not($Context.TargetObject.MailboxType -eq "ADM_EXCHANGE_MAILBOXTYPE_USER" -and `
    $Context.TargetObject.RecipientLocation -eq "ADM_EXCHANGERECIPIENTLOCATION_OFFICE365")

Related questions

0 votes
0 answers

Or would the DLs have to be manually created and rules set up? I'm starting to look into features of the product before demoing, and was hoping there was an easy answer on this one. Thanks

asked Oct 7, 2020 by SIRI-Steele (40 points)
0 votes
1 answer

Ideally looking to make this a rule based group, but report or business unit should work also. In our domain, service accounts become direct reports of the user who requested/ ... if a specific object is a/not a direct report. Is this possible? Thank you

asked Nov 14, 2023 by ThompsonAlex (40 points)
0 votes
1 answer

Hi We create different Groups when a new OU is generated. The name of the groups consist of the OU name with additional text. We would like ... value $Context.SetModifiedPropertyValue($property, $value) $Context.LogMessage($value, "Information") Thanks, Mario

asked Jul 9, 2020 by maca (100 points)
0 votes
1 answer

We currently have a form for HR to deal with ex-employees that are hired once more, but it's not much more than automatic emails sent to IT. If I add some actions ... this trigger the business rule we have that targets "After updating a user" ? Thanks, Louis

asked Oct 18, 2022 by lw.fa (130 points)
0 votes
1 answer

Is there a report that I can run that shows everyone with a specific job title

asked Apr 20, 2023 by sra98a (120 points)
3,572 questions
3,261 answers
8,277 comments
547,995 users