I'm trying to run a powershell script with the Windows task scheduler. The script works perfectly when I run it manually. But receive the following error when executed (with highest privileges) in the Windows task scheduler:
Error while connecting to site 'https://####':The term 'Connect-PnPOnline' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."
I've reinstalled the Pnp PowerShell assembly from here: https://github.com/SharePoint/PnP-PowerShell/releases and verified if the modules are installed correctly with:
Get-Module SharepointPNPPowershellOnline