MSExchangeGuru.com

Learn Exchange the Guru way !!!

 

Office 365 / EOP: Search – Transport Rule from PowerShell

This blog will tell you the steps to search the transport rules using powershell on the desktop computer.

You should have permissions to connect to EOP and transport rules.

 

Here are the Steps:

  1. Open powershell with Run as Administrator on your computer

     

  2. Run the command to cache authentication

    $Cred = Get-credential

     

    This will popup authentication windows. Type your login id which is the User principal name and password.

     

  3. Run the command to configure the powershell to use the office 365.

    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic –AllowRedirection


     

  4. Verify and change the execution policy.

     

    To verify run the command:

    Get-Executionpolicy

     

    To change run the cmd

    Set-ExecutionPolicy RemoteSigned

    

            5. Run the below command to import the session
       Import-PSSession $Session

 

If your executionpolicy will be Restricted then you will see the below error:

Import-PSSession : Files cannot be loaded because the running of scripts is disabled on this system. Please provide a valid certificate with which to sign the files.

          6. Now download the either of the 2 attached PS1 scripts and copy to c:temp directory.
  1. To export to csv use – GetTransportruleincsv.ps1
  2. To export to powershell use – GetTransportruleinpowershell.ps1

    070314_2026_Office365EO8.png 070314_2026_Office365EO7.png

        7. Run the following command then add the search term which can be email address, email domain, IP address or a fragment of text.

 

C:tempGettransportruleincsv.ps1

This will export the matched transport rules in c:tempsearch.csv or extract the result in powershell

Or

C:tempGettransportruleinpowershell.ps1

 

      8. Check the search.csv for the data. Data will have all the rules matching to your search.

 

 

 

Prabhat Nigam

Microsoft Solutions Architect | Exchange Server

Team@MSExchangeGuru

2 Responses to “Office 365 / EOP: Search – Transport Rule from PowerShell”

  1. NeWay Technologies – Weekly Newsletter #102 – July 3, 2014 | NeWay Says:

    […] Office 365 / EOP: Search – Transport Rule from PowerShell – […]

  2. NeWay Technologies – Weekly Newsletter #102 – July 4th, 2014 | NeWay Says:

    […] Office 365 / EOP: Search – Transport Rule from PowerShell – […]

Leave a Reply

Categories

Archives

MSExchangeGuru.com