I'm trying to run a command again some mailboxes, after obtaining the mailbox names from a Retention Compliance Policy.
I can export the GUID to a CSV and then call the CSV, but I'm trying to limit my use of CSV's The Below works with a CSV file
$Accounts = Import-Csv 'C:\Temp\MailboxInfoGUID.csv'
ForEach($Account in $Accounts)
{
$Guid = $null
$Guid = @()
$Guid = $Account.ArchiveGuid
Start-ManagedFolderAssistant -Identity $Guid -FullCrawl}
$Users = Get-RetentionCompliancePolicy $LabelPolicyName -
DistributionDetail | Select - ExpandProperty ExchangeLocation | Select -
ExpandProperty Name
I'd like to run the command without using a CSV file, but to get the mailbox identity I need to look in the Compliance Policy
How can I use the mailbox names obtained from the policy to then run a crawl on the mailbox
If I understood you correct, you would like the following:
Get-RetentionCompliancePolicy
.Get-Mailbox
.Start-ManagedFolderAssistant
.Given that's what you're after, the following should work:
Due keep in mind that I don't have the ExchangePowerShell module installed so I am going off just logic; you may have to adjust the properties.