I'd like to return the litigation hold attribute values if the script returns true. How can I do this?

ago by (390 points)

1 Answer

ago by (310k points)
+1 vote

Hello,

What exactly do you mean by return the litigation hold attribute values? Please, describe the desired behavior in all the possible details with live examples. Pay attention that the referenced script is to be executed in a condition, not action.

ago by (390 points)
0

Okay this is what I am trying to achieve:

I want to create a function that can be ran against a single user or set of users that will check their litigation hold status (true/false) and return the result. If the script returns true, I'd like it to include the additional exchange litigation hold attributes such as msExchLitigationHoldDate & msExchLitigationHoldOwner. If the script returns false, it will simply say "User not on hold" or something along those lines.

ago by (310k points)
+1

Hello,

Thank you for clarifying. Here is the script you can use in a custom command. The script should be executed in the Run a program or PowerShell script action. For details on creating a custom command, see https://www.adaxes.com/help/CreateCustomCommand.

# Get user mailbox parameters
try
{
    $mailboxParams = $Context.TargetObject.GetMailParameters()
}
catch
{
    $Context.LogMessage("User %fullname% has no mailbox.", "Information")
    return
}

# Get user litigation hold settings
$litigationHold = $mailboxParams.MailboxFeatures.GetItemByType("ADM_EXCHANGE_MAILBOXFEATURETYPE_LITIGATIONHOLD")

if ($litigationHold.Enabled -eq $False)
{
    $Context.LogMessage("User %fullname% is not on hold.", "Information")
    return
}

# Output user litigation hold settings
$Context.LogMessage("Litigation hold start date:" + $litigationHold.StartDate, "Information")
$Context.LogMessage("Litigation hold owner:" + $litigationHold.Owner, "Information")
ago by (390 points)
0

I can work with this, thank you!

Related questions

This is only to disable user account

asked Apr 18, 2025 by Erik Lovlie (20 points)
0 votes
1 answer

I haven't seen a version to know the syntax.

asked Sep 4, 2025 by mightycabal (1.2k points)
0 votes
1 answer

We have a 3rd party vendor that we are able to add users based on AD security groups. What I need to do is set a parameter for the number of available licenses and whenever ... the group is 495 I would like an email to trigger telling me to add more licenses.

asked Oct 12, 2022 by A_Pastor (70 points)
0 votes
1 answer

This is from within a custom task. Account has proper RBAC permissions and I can do this from a normal powershell window.

asked Mar 26 by ZoomGhost (370 points)
0 votes
1 answer

The checkbox is not selected (False) by default.

asked May 30, 2022 by john.harding (70 points)
0 votes
1 answer