Skip to content
Nate Ferrell edited this page Aug 23, 2019 · 4 revisions

PSProfile

Powershell module built to handle anything you would want in your PowerShell profile, including module importing, script invoking, variable setting, command aliasing, etc. PSProfile also contains a Secret Vault to easily store and recall PSCredential and named SecureString objects.


Prerequisites

In order to use this module, you will need the following PowerShell 5.1 or greater (PSProfile utilizes PowerShell classes under the hood).


Installing the Module

From the PowerShell Gallery

  1. Open Powershell and run the following command: Install-Module -Name PSProfile -Scope CurrentUser

For more information, please visit the PSProfile page on the Powershell Gallery

From the GitHub release page

This will be equal to the Powershell Gallery, usually

  1. Click here to go to the latest releases, then download the PSProfile.zip file attached to the release
  2. Right-click the downloaded zip, select Properties, then unblock the file. This is to prevent having to unblock each file individually after unzipping.
  3. Unzip the archive.
  4. (Optional) Place the module somewhere in your PSModulePath.
    • You can view the paths listed by running the environment variable $env:PSModulePath

Build from the GitHub repo

Bleeding edge fans, contributors, etc

  1. Clone the repo to your computer: git clone https://github.com/scrthq/PSProfile.git
  2. Open the cloned directory: cd PSProfile
  3. Build the module: .\build.ps1

Building with the default task list will automatically import the module at the end of the build.

If you'd like to import the compiled module in a new session, you can find it under the BuildOutput folder in the root of the repo.

OR

  1. Fork the repo to your local
  2. Import the module by loading the PSD1 file via full path or placing the local repo folder somewhere in your $env:PSMODULEPATH

Getting Started

PSProfile is meant to take place of anything you currently are doing in your $profile script, as well as add some additional features to enhance productivity and ease of use. Because of this, you should add the following line to your PowerShell profile after installing the module:

Import-Module PSProfile

This will automatically import your PSProfile whenever you open a new session. The easiest way to start is by running the following script to add it to your $profile. The file will be created if it does not already exist.

if (-not (Test-Path $profile)) {
    New-Item -ItemType File $profile -Force
}
'Import-Module PSProfile' | Add-Content $profile

Once PSProfile is imported, you'll have a new variable in your session, $PSProfile.

Getting Help

PSProfile includes help and examples on every function, e.g.:

>> Get-Help Add-PSProfilePrompt

NAME
    Add-PSProfilePrompt

SYNOPSIS
    Saves the Content to $PSProfile.Prompts as the Name provided for recall later.


SYNTAX
    Add-PSProfilePrompt [[-Name] <String>] [-Content <Object>] [-SetAsDefault] [<CommonParameters>]


DESCRIPTION
    Saves the Content to $PSProfile.Prompts as the Name provided for recall later.


RELATED LINKS

REMARKS
    To see the examples, type: "get-help Add-PSProfilePrompt -examples".
    For more information, type: "get-help Add-PSProfilePrompt -detailed".
    For technical information, type: "get-help Add-PSProfilePrompt -full"

It also includes handy HelpFiles for each concept:

>> Get-Help about_PSProfile*

Name                               Category Module Synopsis
----                               -------- ------ --------
about_PSProfile                    HelpFile        An overview of PSProfile module and its various components and concepts.
about_PSProfile_Command_Aliases    HelpFile        An overview of the Command Alias concept in PSProfile.
about_PSProfile_Configuration      HelpFile        An overview of the Configuration functions in PSProfile.
about_PSProfile_Helpers            HelpFile        An overview of the Helper functions in PSProfile.
about_PSProfile_Meta               HelpFile        An overview of the Meta functions in PSProfile.
about_PSProfile_Modules_to_Import  HelpFile        An overview of the Modules to Import concept in PSProfile.
about_PSProfile_Modules_to_Install HelpFile        An overview of the Modules to Install concept in PSProfile.
about_PSProfile_Path_Aliases       HelpFile        An overview of the Path Alias concept in PSProfile.
about_PSProfile_Plugins            HelpFile        An overview of the Plugins concept in PSProfile.
about_PSProfile_Plugin_Paths       HelpFile        An overview of the Plugin Paths concept in PSProfile.
about_PSProfile_Project_Paths      HelpFile        An overview of the Project Paths concept in PSProfile.
about_PSProfile_Prompts            HelpFile        An overview of the Prompts concept in PSProfile.
about_PSProfile_Script_Paths       HelpFile        An overview of the Script Paths concept in PSProfile.
about_PSProfile_Secrets            HelpFile        An overview of the Secrets concept in PSProfile.
about_PSProfile_Symbolic_Links     HelpFile        An overview of the Symbolic Link concept in PSProfile.
about_PSProfile_Variables          HelpFile        An overview of the Variables concept in PSProfile.

PSProfile

Concepts

Function Help

Command Aliases

Configuration

Helpers

Init Scripts

Meta

Modules to Import

Modules to Install

Path Aliases

Plugin Paths

Plugins

Power Tools

Project Paths

Prompts

Script Paths

Secrets

Symbolic Links

Variables

Badges

Azure Pipelines      Discord - Chat      Slack - Chat      Codacy PowerShell Gallery      GitHub Releases      GitHub Releases

Clone this wiki locally