powershellsharepoint-onlinepowershellget

PowerShell Install Module command not failing but not installing module


I am trying to install the PnP online commands for SharePoint onto my PowerShell however the following command doesn't seem to work;

Install-Module -name SharePointPnPPowerShellOnline -scope CurrentUser

The command seems to run through fine with no errors appearing but when I try to run Commands which should have been installed I get an error saying the commands can not be found.

connect-pnponline : 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.
At line:1 char:1
+ connect-pnponline
+ ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (connect-pnponline:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I have had a look at all the module folders and the module is not in any of them. I have compared my environment paths with a coworker who has this working and they are the same.

Does anyone know what might be causing this?


Solution

  • This was caused by by modules being stored on OneDrive. By default my module path was set to "%USERPROFILE%\Documents\WindowsPowerShell\Modules" but since i had OneDrive installed my path changed to "%USERPROFILE%\OneDrive\Documents\WindowsPowerShell\Modules".

    To resolve this issue I went to Documents>Windows Powershell>Modules and copied the link. Then, via the Start' menu, I went to 'Edit the system environment variables'>advanced>Environment Variables, highlighted PSModulePath and clicked Edit. Once in this window I clicked New and pasted the link I found above. This resolved the problem I was experiencing.