title: Exchange online powershell script receive "Cannot convert hashtable to an object of the following type" error
body: <p>I am attempting to put together an Exchange Online (Office 365) PowerShell script to bulk process mailboxes with the commandlet <strong>set-clutter</strong> in order to turn off the mailbox clutter feature. The following PowerShell command can be run for individual mailboxes: </p>
  
  <pre><code>set-clutter -identity "MailboxIdentityHere" -enable $false
  </code></pre>
  
  <p>I have a CSV file with the identities of each mailbox.</p>
  
  <p>I am not a programmer and am a novice with scripting and realize I don't completely understand my issue.</p>
  
  <p>I have been able to put together the following script: </p>
  
  <pre><code>$Identities = Import-csv "pathtofile\filename.csv"
  foreach ($Identity in $Identities)  
  {
  set-clutter -identity $Identity -enable $false
  }
  </code></pre>
  
  <p>However I get the following error repeated for each iteration of the mailboxes listed in the CSV file:</p>
  
  <blockquote>
    <p>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</p>
  </blockquote>
  
  <p>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.</p>
  
  <p>Here is an example of how the CSV file looks:</p>
  
  <blockquote>
    <p>ALIAS</p>
    
    <p>ProjectMailbox1<br> ProjectMailbox2<br> ProjectMailbox3<br>
    ProjectMailbox4<br> etc...</p>
  </blockquote>