Exchange Powershell Profile

Home Forums Scripting PowerShell Exchange Powershell Profile

This topic contains 3 replies, has 2 voices, and was last updated by Avatar sailingbikeruk 5 years, 5 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #163358

    All,

    I am not sure if this should be in the Exchange Forum or the Powershell forum…

    I have an exchange 2010 Hybrid environment in a multi-domain forest. Whenever I need to use exchange powershell I have to change the recipient scope using the cmdlet Set-AdServerSettings -ViewEntireForest $true

    What I would like to do is to have exchange Powershell Module run this automatically at startup so I created a powershell profile and added the cmdlet to a ps1 file but it loads BEFORE the exchange module is loaded so I get an error everytime.

    In addition it loads whenever I start any powershell session rather than just the exchange module.

    Is there a way I can get this to load in the exchange powershell session only (not non-exchange powershell) and to do so AFTER it has loaded the necessary modules.

    Avatar
    wullieb1
    Moderator
    #244667

    Re: Exchange Powershell Profile

    Create a profile

    http://technet.microsoft.com/en-us/library/ee156814.aspx

    #314492

    Re: Exchange Powershell Profile

    wullieb1;282190 wrote:
    sailingbikeruk;282162 wrote:
    All,

    so I created a powershell profile and added the cmdlet to a ps1 file but it loads BEFORE the exchange module is loaded so I get an error everytime.

    Have I not already tried that? My problem was that the profile didn’t solve it so I have either done something wrong or it isn’t the solution.

    Avatar
    wullieb1
    Moderator
    #244680

    Re: Exchange Powershell Profile

    sailingbikeruk;282372 wrote:
    Have I not already tried that? My problem was that the profile didn’t solve it so I have either done something wrong or it isn’t the solution.

    Sorry I missed that.

    What file have you editied?

    Open powershell and type $profile and check that you’ve edited the correct profile.

    Mine is current located in My DocumentsWindowsPowershell Folder

    Another method by creating a dedicated shortcut. Show with IIS but should be similar.

    http://blogs.iis.net/sergeia/archive/2009/06/16/how-to-automate-windows-7-powershell-start-up-with-iis-module.aspx

    No time to test at the moment but if I get a chance over the weekend I will try.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Register for this Petri Webinar!

Want to Make Your Backup Storage Unlimited & Ready for the Cloud? – Free Thurrott Premium Account with Webinar Registration!

Tuesday, August 27, 2019 @ 1:00 pm EDT

A Scale-Out Backup storage infrastructure is a must-have technology for your backups. In this webinar, join expert Rick Vanover for a look on what real-world problems are solved by the Scale-Out Backup Repository.

Register Now

Sponsored By