title: How to convert string to boolean in this Powershell code for Exchange Online?
body: <p>My code is:</p>
  
  <pre><code>Import-Csv "$env:userprofile\Desktop\ExternalContacts.csv"| foreach {New-MailContact -Name $_.Name -DisplayName $_.Name -ExternalEmailAddress $_.ExternalEmailAddress -FirstName $_.FirstName -LastName $_.LastName | Set-MailContact -Identity $_.Name -HiddenFromAddressListsEnabled $_.HiddenFromAddressListsEnabled}
  </code></pre>
  
  <p>And I am getting:</p>
  
  <p>Cannot process argument transformation on parameter 'HiddenFromAddressListsEnabled'. Cannot convert value "System.String" to type "System.Boolean", parameters of this type only accept booleans or numbers, use $true, $false, 1 or 0 instead.</p>
  
  <p>Here are the first two rows of my CSV file as viewed in Notepad:</p>
  
  <p><code>Name,FirstName,LastName,ExternalEmailAddress,HiddenFromAddressListsEnabled</code><br>
  <code>Ted Testington,Ted,Testington,ted.testington@blah.com,$true</code></p>
  
  <p>How can I do the necessary conversion?</p>
  
  <p>Thanks.</p>