SOLVED

How to get full string Get-AntiPhishPolicy -Impersonation TargetedDomainsToProtect attribute

Copper Contributor

Hi there,

 

I am trying to build a command to get all TargetedDomainsToProtect from one of our Anti phishing policies using Get-AntiPhishPolicy

 

Get-AntiPhishPolicy -Identity "Anti-phishing Policy" -Impersonation | Format-Table TargetedDomainsToProtect -AutoSize

 

We have added multiple domains and we would like to retrieve the entire attribute, not as I get it as default:

 

TargetedDomainsToProtect
------------------------
{domain1.com, domain2.com, domain3.com...}

 

Is there a way of extracting the full collection of domains?

 

I have tried Format-Table, Out-File, Out-String without success.

 

Thank you in advance.

 

Kind regards

 

Marcos

2 Replies
best response confirmed by Marcos_Salo (Copper Contributor)
Solution

Hi @Marcos_Salo,

 

You could try the following:

(Get-AntiPhishPolicy -Identity "Anti-phishing Policy" -Impersonation).TargetedDomainsToProtect

or

$policy = Get-AntiPhishPolicy -Identity "Anti-phishing Policy" -Impersonation
$policy.TargetedDomainsToProtect

Regards,

Ruud

Dear Ruud,

Thank you very much.

Both options work smoothly. :)

Highly appreciate.

Have a good day.

Regards

Marcos
1 best response

Accepted Solutions
best response confirmed by Marcos_Salo (Copper Contributor)
Solution

Hi @Marcos_Salo,

 

You could try the following:

(Get-AntiPhishPolicy -Identity "Anti-phishing Policy" -Impersonation).TargetedDomainsToProtect

or

$policy = Get-AntiPhishPolicy -Identity "Anti-phishing Policy" -Impersonation
$policy.TargetedDomainsToProtect

Regards,

Ruud

View solution in original post