Forum Discussion

Marcos_Salo's avatar
Marcos_Salo
Copper Contributor
Jan 13, 2023
Solved

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

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

  • 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

  • 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

    • Marcos_Salo's avatar
      Marcos_Salo
      Copper Contributor
      Dear Ruud,

      Thank you very much.

      Both options work smoothly. 🙂

      Highly appreciate.

      Have a good day.

      Regards

      Marcos

Resources