365 atp script

%3CLINGO-SUB%20id%3D%22lingo-sub-2004891%22%20slang%3D%22en-US%22%3E365%20atp%20script%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2004891%22%20slang%3D%22en-US%22%3E%3CDIV%20class%3D%22kvgmc6g5%20cxmmr5t8%20oygrvhab%20hcukyx3x%20c1et5uql%20ii04i59q%22%3E%3CDIV%3Ehey%20everyone%20first%20of%20all%20sorry%20for%20my%20english%20%2C%20i%20hope%20somone%20can%20help%20me%3C%2FDIV%3E%3CDIV%3Eim%20try%20to%20configure%20an%20atp%20policy%20in%20my%20organization%20.%3C%2FDIV%3E%3CDIV%3Enow%20my%20problem%20is%20%2C%20when%20i%20need%20to%20set%20the%20-recipient%20domain%20value%3C%2FDIV%3E%3CDIV%3Eit%20doesnt%20give%20me%20an%20option%20to%20insert%20a%20csv%20or%20use%20on%20wildcard%3C%2FDIV%3E%3CDIV%3E%3CPRE%3E%3CSPAN%3EI%20mean%20the%20script%20knew%20to%20include%20in%20this%20entry%20all%20the%20existing%20domain%20names%3C%2FSPAN%3E%3C%2FPRE%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3Elets%20say%20i%20have%203%20domain%20on%20the%20same%20tennent%3A%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3Edomain%201%3C%2FDIV%3E%3CDIV%3Edomain%202%3C%2FDIV%3E%3CDIV%3Edomain%203%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FDIV%3E%3CDIV%20class%3D%22o9v6fnle%20cxmmr5t8%20oygrvhab%20hcukyx3x%20c1et5uql%20ii04i59q%22%3E%3CDIV%3Ei%20will%20add%20my%20code%20.%20and%20the%20error%20i%20got.%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3Ecode%3A%3C%2FDIV%3E%3CDIV%3EConnect-MsolService%20-Credential%20%24a%3C%2FDIV%3E%3C%2FDIV%3E%3CDIV%20class%3D%22o9v6fnle%20cxmmr5t8%20oygrvhab%20hcukyx3x%20c1et5uql%20ii04i59q%22%3E%3CDIV%3EGet-MsolDomain%20%7Cselect%20name%20%7CExport-Csv%20-Path%20.%5Ctest.csv%20-NoTypeInformation%3C%2FDIV%3E%3C%2FDIV%3E%3CDIV%20class%3D%22o9v6fnle%20cxmmr5t8%20oygrvhab%20hcukyx3x%20c1et5uql%20ii04i59q%22%3E%3CDIV%3E%24b%3DImport-Csv%3C%2FDIV%3E%3C%2FDIV%3E%3CDIV%20class%3D%22o9v6fnle%20cxmmr5t8%20oygrvhab%20hcukyx3x%20c1et5uql%20ii04i59q%22%3E%3CDIV%3Eforeach(%24i%20in%20%24b)%7B%3C%2FDIV%3E%3CDIV%3Eset-AntiPhishRule%20-Identity%20%22SecureTest%22%20-RecipientDomainIs%20%24b%3C%2FDIV%3E%3CDIV%3E%7D%3C%2FDIV%3E%3C%2FDIV%3E%3CDIV%20class%3D%22o9v6fnle%20cxmmr5t8%20oygrvhab%20hcukyx3x%20c1et5uql%20ii04i59q%22%3E%3CDIV%3Eerror%3A%3C%2FDIV%3E%3C%2FDIV%3E%3CDIV%20class%3D%22o9v6fnle%20cxmmr5t8%20oygrvhab%20hcukyx3x%20c1et5uql%20ii04i59q%22%3E%3CDIV%3ECannot%20process%20argument%20transformation%20on%20parameter%20'RecipientDomainIs'.%20Cannot%20convert%20value%20%22%40%7BName%3D%3CSPAN%3E%3CA%20href%3D%22http%3A%2F%2Ftest1111.onmicrosoft.com%2F%3Ffbclid%3DIwAR35lXGUDWfKWFEST8L_YK2M54f58gd_CYsH5wh1CcwI_VmrTbQNART2J64%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Etest1111.onmicrosoft.com%3C%2FA%3E%3C%2FSPAN%3E%7D%22%20to%20type%20%22Microsoft.Exchange.Data.Word%5B%5D%22.%20Error%3A%20%22Cannot%20convert%20value%3C%2FDIV%3E%3CDIV%3E%22%40%7BName%3D%3CSPAN%3E%3CA%20href%3D%22http%3A%2F%2Ftest1111.onmicrosoft.com%2F%3Ffbclid%3DIwAR23Q56NMgbekQgMLQqNeZFwc1uPHnXBAQqO6wuM_E8Y7XE-Bu0dgKJ0uXQ%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Etest1111.onmicrosoft.com%3C%2FA%3E%3C%2FSPAN%3E%7D%22%20to%20type%20%22Microsoft.Exchange.Data.Word%22.%20Error%3A%20%22Cannot%20convert%20the%20%22%40%7BName%3D%3CSPAN%3E%3CA%20href%3D%22http%3A%2F%2Ftest1111.onmicrosoft.com%2F%3Ffbclid%3DIwAR3WAEdzbwNErdnyHt_TD4WV-_dSbuzlN31GoT3fwW5ZERTl7uScI8ikZOk%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Etest1111.onmicrosoft.com%3C%2FA%3E%3C%2FSPAN%3E%7D%22%20value%20of%20type%20%22Deserialized.System.Management.Automation.PSCustomObject%22%20to%3C%2FDIV%3E%3CDIV%3Etype%20%22Microsoft.Exchange.Data.Word%22.%22%22%3C%2FDIV%3E%3CDIV%3E%2B%20CategoryInfo%20%3A%20InvalidData%3A%26nbsp%3B%3CP%3E%26nbsp%3B%3C%2FP%3E)%20%5BSet-AntiPhishRule%5D%2C%20ParameterBindin...mationException%3C%2FDIV%3E%3CDIV%3E%2B%20FullyQualifiedErrorId%20%3A%20ParameterArgumentTransformationError%2CSet-AntiPhishRule%3C%2FDIV%3E%3CDIV%3E%2B%20PSComputerName%20%3A%20%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Foutlook.office365.com%2F%3Ffbclid%3DIwAR0rxriADaeUz1ROqEHFP5oO1-DsRcAtmtvAUZ94pO-TNd6ZxWeY9QSqCCQ%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Eoutlook.office365.com%3C%2FA%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FDIV%3E%3CDIV%20class%3D%22o9v6fnle%20cxmmr5t8%20oygrvhab%20hcukyx3x%20c1et5uql%20ii04i59q%22%3E%3CDIV%3Ei%20try%20different%20option%20and%20i%20dident%20succesed%20.%3C%2FDIV%3E%3C%2FDIV%3E%3CDIV%20class%3D%22o9v6fnle%20cxmmr5t8%20oygrvhab%20hcukyx3x%20c1et5uql%20ii04i59q%22%3E%3CDIV%3Ethe%20value%20properties%20is%3A%3C%2FDIV%3E%3CDIV%3E-RecipientDomainIs.%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E
Visitor
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