Skip to content

anoopt/PnP.PowerShell.Predictor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PnP PowerShell Predictor module

Overview

PnP PowerShell Predictor is a PowerShell module that helps you navigate the cmdlets and parameters of PnP PowerShell. It provides suggestions for command completion when using PnP PowerShell cmdlets.

PnP PowerShell Predictor uses the subsystem plugin model available in PowerShell 7.2. This updated version requires PSReadLine 2.2.2 or higher to display suggestions.

demo

Requirements

Required configuration for PnP PowerShell Predictor:

Install the latest version of PSReadLine:

Install-Module -Name PSReadline

Set preferred source and view for suggestions

Enable predictions from history and plugins

Set-PSReadLineOption -PredictionSource HistoryAndPlugin

Enable list view:

Set-PSReadLineOption -PredictionViewStyle ListView

Getting started

Install PnP PowerShell Predictor

To install the PnP.PowerShell.Predictor PowerShell module run the following

Install-Module -Name PnP.PowerShell.Predictor

Import PnP PowerShell Predictor

To import the PnP PowerShell Predictor PowerShell module in the current session run the following

Import-Module -Name PnP.PowerShell.Predictor

Use PnP PowerShell Predictor

Once imported, start typing PnP PowerShell cmdlet (e.g. Connect-PnPOnline) and see the predictions loading.

Predictions source warning

The module tries to get the version of the cmdlets from GitHub based on the PnP PowerShell version on your machine. In case, it is not able to find the version of cmdlets from GitHub then it will load a set of predictions that are shipped with the module.

Hence some commands from the predictions might not be present in the version on PnP PowerShell on your machine and they might not work.

To disable this warning, set the environment vaiable PnPPredictorShowWarning to false in your profile.ps1 file.

$env:PnPPredictorShowWarning = "false"

Changing predictions search method

By default the module uses Contains search i.e. it shows predictions that contain the input entered. This can be changed to either StartsWith or Fuzzy by using the following cmdlet

Set-PnPPredictorToolSearch -Method StartsWith|Contains|Fuzzy

StartsWith - as per the name shows predictions that start with the entered input Fuzzy - does a Fuzzy search and returns predictions. Sometimes the results might not be as per the expectaion in this case.

Disabling PnP PowerShell Predictor suggestions in the current session

To disable PnP PowerShell Predictor suggestions in the current session run the following

Disable-PnPPredictorToolSuggestions

Enabling PnP PowerShell Predictor suggestions in the current session

To enable PnP PowerShell Predictor suggestions in the current session run the following

Enable-PnPPredictorToolSuggestions

Uninstallation

Once installed and enabled, PnP PowerShell Predictor is loaded in the PowerShell profile. To uninstall the PnP.PowerShell.Predictor module:

  1. Close all PowerShell sessions including VS Code.

  2. Launch a PowerShell session with no profile.

    pwsh -noprofile
  3. Uninstall PnP PowerShell Predictor

    Uninstall-Module -Name PnP.PowerShell.Predictor -Force
  4. Close PowerShell

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published