If you have commands you want to run every time you run Powershell, such as import-module to get commands for specific software, you can do that by creating a Powershell Profile.

You can find your profile path by running the command:


Test to find out if the file is already there:

test-file $profile

If it returns false, you will need to create it.  This command works on Windows 8.x with Powershell 4.0:

New-Item -Path $profile -ItemType file -Force

If you are on an older version, you may need to modify -ItemType to -Type.

Now to edit the file, simply execute the command:

notepad $profile

Now add the lines to the profile that you want to run automatically every time you start Powershell.  Here are some examples.  Note that to import modules, you must have installed the appropriate module files before they will work.


Import-Module ActiveDirectory

Import-Module MSOnline

Import-Module LyncOnlineConnector

Import-Module “C:\Program Files\Microsoft System Center 2012 R2\Service Manager\Powershell\System.Center.Service.Manager.psd1”

$PSDefaultParameterValues = @{“*-AD*:Server”=’yourfqdnforyourdomaincontrollername’}