NLWeb Pioneers: Success Stories & Use Cases
May 24, 2025Summary
When testing scripts, you may need functionality in a newer version of PNP than what you have installed on your device. Also, there may be a need to run an older version, if your script is using functions or parameters that were deprecated in newer versions. This blog will walk you through the process of using any version of PNP without installation.
Steps
- Determine which version of PNP is needed and the PowerShell requirements of that version.
- PnP.PowerShell 1.1.0 requires PS 5.1 or higher.
- PNP.PowerShell 2.0 requires PS 7.2 or higher.
- PnP.PowerShell 3.0 Requires PS 7.4 and higher
- One you have the requirements down, make sure are using the correct version of PowerShell to load the PnP.PowerShell modules.
Note: PowerShell 5.x comes with Windows. You need to download PowerShell 7.x.
See: Installing PowerShell on Windows – PowerShell | Microsoft Learn
- Locate the version of PnP.PowerShell you want to test, by visiting the PnP.PowerShell Gallery
https://www.powershellgallery.com/packages/PnP.PowerShell
- Expand the “File List” and locate the version you want. For this Blog, I will focus on the latest version.
- After clicking on version 3.1.22-nightly, you will see 4 install options.
- Install module
- Install PSResource
- Azure Automation
- Manual Download
Note: We will be focusing on the Manual Download option.
- Click on manual download.
- Now download the raw “nupkg” file.
- The file “pnp.powershell.3.1.22-nightly.nupkg” will be downloaded.
- Move the file to a new empty folder.
- For this example, I’m using C:temppnp.powershell.3.1.22
- Open the folder and rename your file with a .zip extension.
Note: My name file name is “pnp.powershell.3.1.22-nightly.zip”
- Extract the folder into your preferred location.
For example, I will extract my folder too “c:temppnp.powershell.3.1.22-nightly”.
- Now open PowerShell 7x as Admin from your device.
Hint: Search for “PowerShell” in your Start menu.
Note: If you don’t have PowerShell 7 installed, see: https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows
- Change Directory to the folder you extracted PNP.
cd C:temppnp.powershell.3.1.22pnp.powershell.3.1.22-nightly
- Import the PNP Module
import-module -name .PnP.PowerShell.psd1
- You may get an error stating the import failed because it’s a nightly build that is not digitally signed.
- If this occurs, set your execution policy
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
- Now try importing the module again.
import-module -name .PnP.PowerShell.psd1
- Now verify the imported module.
get-module -name “PnP.PowerShell”
- Success!!! You have loaded your desired version of PNP, Great Job!!!
Test running PNP
- Register a new PNP App to use with interactive mode.
Register-PnPEntraIDAppForInteractiveLogin -ApplicationName “PNPAPP” -Tenant m365cpi13246019.onmicrosoft.com
- After running this command, you may be a prompted to consent to the permissions.
- This new application will now shows up in Entra App Registrations.
- Notice the default permissions created after executing the register command
- Let’s test it using the new Client ID.
connect-pnponline -url “https://m365cpi13246019-admin.sharepoint.com” -clientId ‘1e892341-f9cd-4c54-82d6-0fc3287954cf’-Interactive
- You will be prompted for a username and password. Ensure to use sure your SharePoint Admin Account here.
- Now you are free to use PNP commands that are included with the targeted version of PNP, without installing the module.
Conclusion:
In summary, following the outlined steps will enable you to run any version of PNP without installation. By carefully adhering to each step, you can ensure a smooth and efficient process, ultimately achieving the desired outcome. Remember to double-check each step for accuracy and completeness to avoid any potential issues.