How to Load commands into your powershell profile to run on starting powershell

Posted by JohnyV on Server Fault See other posts from Server Fault or by JohnyV
Published on 2010-04-26T21:35:00Z Indexed on 2010/04/26 21:43 UTC
Read the original article Hit count: 865

Hi, I have found a way to load exchange 2010 powershell into powershell running on a windows xp workstation, however there are a few commands that need to run. I was wondering how I could load them into a profile somehow. These are the commands that I need to run before I can do any of the exchange things such as Get-Mailbox.

COMMAND 1 $session = New-PSSession -Configurationname Microsoft.Exchange –ConnectionUri http://servername/powershell -Credential $user

(it prompts you for a username and p/word then the next command)

COMMAND 2 Import-PSSession $session

Then I am able to run exchange 2010 commands such as Get-Mailbox. Anyway I can load these so that when I click on the powershell shortcut they preload the importing of exchange commands.

Thanks

© Server Fault or respective owner

Related posts about powershell

Related posts about exchange-2010