Litigation Hold list of inactive (exited) users

Tammy Rule
Tammy Rule used Ask the Experts™
on
I need to find a way to create a list of litigation hold users and also whether they are still considered licensed users or have previously exited the company.  I create this list of these users using the below unable to figure out a what to display which ones are still licensed or not.

get-mailbox -ResultSize Unlimited | where-object {($_.litigationholdenabled -eq "true")} | Select primarysmtpaddress |  Export-CSV d:\lithold.csv
#
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
O365 Administrator
Commented:
I figured out how to do it but not with just the one script.  I ran this other one that I had on hand to get the licensed users -
Get-MsolUser -All | Where-Object { $_.isLicensed -eq "TRUE" } | Select DisplayName, FirstName, LastName, UserPrincipalName, @{Name="PrimaryEmailAddress";Expression={$_.ProxyAddresses |?{$_ -cmatch '^SMTP\:.*'}}},@{name="Licenses";expression={$_.licenses.accountskuid}} | Export-Csv c:\LicensedUsers.csv -NoTypeInformation
and used an AccessDB to math up the lithold users - if they had a license or didn't.  I'm sure there is an easier way but was under the gun on this one.
Tammy RuleO365 Administrator

Author

Commented:
Thank you.  This worked.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial