365 atp script

Copper Contributor
hey everyone first of all sorry for my english , i hope somone can help me
im try to configure an atp policy in my organization .
now my problem is , when i need to set the -recipient domain value
it doesnt give me an option to insert a csv or use on wildcard
I mean the script knew to include in this entry all the existing domain names
 
lets say i have 3 domain on the same tennent:
 
domain 1
domain 2
domain 3
 
i will add my code . and the error i got.
 
code:
Connect-MsolService -Credential $a
Get-MsolDomain |select name |Export-Csv -Path .\test.csv -NoTypeInformation
$b=Import-Csv
foreach($i in $b){
set-AntiPhishRule -Identity "SecureTest" -RecipientDomainIs $b
}
error:
Cannot process argument transformation on parameter 'RecipientDomainIs'. Cannot convert value "@{Name=test1111.onmicrosoft.com}" to type "Microsoft.Exchange.Data.Word[]". Error: "Cannot convert value
"@{Name=test1111.onmicrosoft.com}" to type "Microsoft.Exchange.Data.Word". Error: "Cannot convert the "@{Name=test1111.onmicrosoft.com}" value of type "Deserialized.System.Management.Automation.PSCustomObject" to
type "Microsoft.Exchange.Data.Word".""
+ CategoryInfo : InvalidData: 

 

) [Set-AntiPhishRule], ParameterBindin...mationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Set-AntiPhishRule
+ PSComputerName : outlook.office365.com
 
i try different option and i dident succesed .
the value properties is:
-RecipientDomainIs.
0 Replies