Litigation Hold list of inactive (exited) users

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
Tammy RuleO365 AdministratorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Member_2_6545326O365 AdministratorCommented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tammy RuleO365 AdministratorAuthor Commented:
Thank you.  This worked.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.