Path Environment Variable

Scenario/Problem: You have scripts within a local folder which you want PowerShell to recognize such that you do not need to use the full path name.

Solution: Add the local directory path to the PSModulePath variable.

You add the local folder’s path to the PSModule environment variable by entering the following command in the PowerShell command prompt (substituting <folder path> with the local directory path), as shown in Listing 2.2.

Listing 2.2. Adding a Folder Path to the PSModulePath

$env:PSModulePath = $env:PSModulePath + ";c:\<folder path>"

Tip

Add the same exact command line into the PowerShell profile configuration file to always have your local folder added to the PSModulePath. See http://technet.microsoft.com/en-us/library/dd315342.aspx ...

Get PowerShell™ for SharePoint® 2013 How-To now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.