We are using PnP powershell which works as expected. However, sometimes we face an exception intermittently with the error as given below. The PnP powershell script line is
Connect-PnPOnline -Url $DestinationSite -Credential (Get-Credential)
We are able to fix if we reinstall PnP module again. But what is the reason this issue keeps appearing intermittently?
**Connect-PnPOnline : The 'Connect-PnPOnline' command was found in the module 'SharePointPnPPowerShellOnline', but the module could not be loaded. For more information, run 'Import-Module SharePointPnPPowerShellOnline'. At C:\MyMigScript\04a StartOneDriveMigration.ps1:82 char:21 + Connect-PnPOnline ` + ~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Connect-PnPOnline:String) [], CommandNotFoundException + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Could not load type 'Microsoft.SharePoint.Client.SearchBoxInNavBarType' from assembly 'Microsoft.SharePoint.Client, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'. Connect-PnPOnline : The 'Connect-PnPOnline' command was found in the module 'SharePointPnPPowerShellOnline', but the module could not be loaded. For more information, run 'Import-Module SharePointPnPPowerShellOnline'. At C:\MyMigScript\04a StartOneDriveMigration.ps1:82 char:21 + Connect-PnPOnline ` + ~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Connect-PnPOnline:String) [], CommandNotFoundException + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Could not load type 'Microsoft.SharePoint.Client.SearchBoxInNavBarType' from assembly 'Microsoft.SharePoint.Client, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'. Connect-PnPOnline : The 'Connect-PnPOnline' command was found in the module 'SharePointPnPPowerShellOnline', but the module could not be loaded. For more information, run 'Import-Module SharePointPnPPowerShellOnline'. At C:\MyMigScript\04a StartOneDriveMigration.ps1:82 char:21 + Connect-PnPOnline ` + ~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Connect-PnPOnline:String) [], CommandNotFoundException + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule**