To verify the installation, we can use the following PowerShell command. You can also use this command if you are new to the machine and would like to find out whether the PnP PowerShell module is already installed or not:
Get-Module SharePointPnPPowerShell* -ListAvailable | Select-Object Name,Version | Sort-Object Version -Descending
The following screenshot shows the output of the preceding command:
Once you've verified that the PnP PowerShell module for SharePoint Online is installed, we can then get started with executing the cmdlets. Since Office 365 is hosted by Microsoft, we don't have direct access to the servers SharePoint is installed on and running from. We need to use remote management.
To use the PnP PowerShell module, we need to first connect to our SharePoint Online tenant/SharePoint Online site using the following command:
Connect-PnPOnline –Url https://yoursite.sharepoint.com –Credentials (Get-Credential)
The following screenshot shows the output of the preceding command:
If your credentials are correct and the connection is successful, you will not get any error message. To get another visual confirmation, you can execute the following command:
Get-PnPSite
The following screenshot shows the output of the preceding command:
To view all cmdlets, we can use Get-Command -Module *PnP*. Or, go to the page https://msdn.microsoft.com/en-us/pnp_powershell/pnp-powershell-overview. To get help on a particular cmdlet, the command is Get-Help New-PnPList -Detailed.