Find Accounts with specific License that dont have Litigation Hold enabled
i trying condense current script processes accounts 1 processes newly licensed accounts.
basically im trying find accounts have specific license(sku) not have litigation hold enabled. dont need enable litigation hold on accounts, 1 specific license.
when execute this
get-mailbox | {$_.litigationholdenabled -match "false"}
i list of accounts dont have litigation hold, know part working
but when try expand this
$lithold = get-mailbox | {$_.litigationholdenabled -match "false"}
$users = $lithold | %{get-msoluser -userprincipalname $_.userprincipalname} | %{$_.licenses[0].accountskuid -like "exchangeenterprise"}
i no results, though know test account has exchangeentrerprise license applied , not have litigation hold enabled.
what need accomplish enabling litigation hold 3 years(1095 days) on newly licensed accounts specific license applied, or like
$lithold = get-mailbox | {$_.litigationholdenabled -match "false"}
$users = $lithold | %{get-msoluser -userprincipalname $_.userprincipalname} | %{$_.licenses[0].accountskuid -like "exchangeenterprise"} | set-mailbox -litigationholdenabled $true -litigationholdduration 1095
any appreciated.
use "-match" instead of like.
\_(ツ)_/
Windows Server > Windows PowerShell
Comments
Post a Comment