I am attempting to put together an Exchange Online (Office 365) PowerShell script to bulk process mailboxes with the commandlet set-clutter in order to turn off the mailbox clutter feature. The following PowerShell command can be run for individual mailboxes:
set-clutter -identity "MailboxIdentityHere" -enable $false
I have a CSV file with the identities of each mailbox.
I am not a programmer and am a novice with scripting and realize I don't completely understand my issue.
I have been able to put together the following script:
$Identities = Import-csv "pathtofile\filename.csv"
foreach ($Identity in $Identities)
{
set-clutter -identity $Identity -enable $false
}
However I get the following error repeated for each iteration of the mailboxes listed in the CSV file:
Cannot process argument transformation on parameter 'Identity'. Cannot convert value "@{IDENTITY =ProjectMailbox1}" to type "Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter". Error: "Cannot convert hashtable to an object of the following type: Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter. Hashtable-to-Object conversion is not supported in restricted language mode or a Data section." + CategoryInfo : InvalidData: (:) [Set-Clutter], ParameterBindin...mationException + FullyQualifiedErrorId : ParameterArgumentTransformationError,Set-Clutter + PSComputerName : outlook.office365.com
Based off the error message I believe I unerstand that there is a mismatch in the data type between what is being passed from the CSV file to the variable and what the commandlet is expecting. I don't have enough knowledge to proceed further or remedy this.
Here is an example of how the CSV file looks:
ALIAS
ProjectMailbox1
ProjectMailbox2
ProjectMailbox3
ProjectMailbox4
etc...