My code is:
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}
And I am getting:
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.
Here are the first two rows of my CSV file as viewed in Notepad:
Name,FirstName,LastName,ExternalEmailAddress,HiddenFromAddressListsEnabled
Ted Testington,Ted,Testington,ted.testington@blah.com,$true
How can I do the necessary conversion?
Thanks.