title: Converting string to boolean in PowerShell when importing data from a CSV file
body: <p>I'm migrating an on-prem Exchange environment to Office 365 and currently trying to script some of the migration tasks. One task in particular is to export groups and group members to CSV from the on-prem environment, then import the CSV data to Office 365.</p>
  
  <p>I've created the following script to try and import the groups to Office 365:</p>
  
  <pre><code># Import distribution groups from CSV to Office 365
  Import-Csv c:\admin\exchange-migration\exports\distribution-groups.csv | foreach {
      New-DistributionGroup -Name $_.name -Alias $_.alias -PrimarySmtpAddress $_.primarysmtpaddress -Type Distribution -RequireSenderAuthenticationEnabled ([System.Convert]::ToBoolean($_.requiresenderauthenticationenable))
  }
  </code></pre>
  
  <p>I was having trouble with the "requiresenderauthenticationenabled" portion cause I couldn't convert a string to a boolean value, but after some research I came up with the <code>[System.Convert]</code> option. However now every value is being treated as FALSE. </p>
  
  <p><a href="https://i.stack.imgur.com/tqSMA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tqSMA.png" alt="Here&#39;s my CSV"></a></p>