Skip to content

anoopt/CLI.Microsoft365.PowerShell.Predictor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLI for Microsoft 365 PowerShell Predictor module

Overview

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

CLI for Microsoft 365 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 CLI for Microsoft 365 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 CLI for Microsoft 365 PowerShell Predictor

To install the CLI.Microsoft365.PowerShell.Predictor PowerShell module run the following

Install-Module -Name CLI.Microsoft365.PowerShell.Predictor

Import CLI for Microsoft 365 PowerShell Predictor

Option 1

To import the CLI.Microsoft365.PowerShell.Predictor PowerShell module for all sessions,

  1. Open the PowerShell profile file in a text editor
notepad $PROFILE
  1. Add the following in the end
Import-Module -Name CLI.Microsoft365.PowerShell.Predictor

Option 2

To import the CLI for Microsoft 365 PowerShell Predictor module in the current session run the following

Import-Module -Name CLI.Microsoft365.PowerShell.Predictor

Use CLI for Microsoft365 PowerShell Predictor

Once imported, start typing a CLI for Microsoft 365 cmdlet (e.g. m365 spo app) and see the predictions loading.

Changing predictions search method

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

Set-PnPPredictorSearch -Method StartsWith

The module then needs to re-imported.

StartsWith - as per the name shows predictions that start with the entered input.

Updating predictions

The predictions are based on the CLI for Microsoft 365 version installed on the machine. When a new version of CLI for Microsoft 365 is installed then the predictions are automatically updated when the module is imported or can be updated by running the following function

Update-CLIMircosoft365Predictions $(m365 version).replace('v', '').replace('"', '')

Uninstallation

Once installed and enabled, CLI for Microsoft 365 PowerShell Predictor is loaded in the PowerShell profile. To uninstall the CLI.Microsoft365.PowerShell.Predictor module:

  1. Close all PowerShell sessions including VS Code.

  2. Launch a PowerShell session with no profile.

    pwsh -noprofile
  3. Uninstall CLI for Microsoft 365 PowerShell Predictor

    Uninstall-Module -Name CLI.Microsoft365.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