Product: PowerShell Universal
Version: 3.7.10
I have a problem with the PNP Module and Powershell 5.1,
here a little test script:
whoami
$PSVersionTable.PSVersion
$SPOSite = "https://ourdomain.sharepoint.com/sites/ITTeam/"
$ListName= "User logins"
Connect-PnPOnline -Url $SPOSite -ClientId $clientId -ClientSecret $clientSecret -WarningAction Ignore
write-host "Debug: Get-PnPListItem"
$spoItem = Get-PnPListItem -List $ListName -PageSize 1
When I do run this via Powershell Universal I do get an Error:
[information] de-pscron02\svc-pscron
[information] Major Minor Build Revision
[information] ----- ----- ----- --------
[information] 5 1 17763 3770
[information] Debug: Get-PnPListItem
[error] Exception has been thrown by the target of an invocation.
When I run it via Powershell on the Machine directly with the same user, all is fine:
de-pscron02\svc-pscron
Major Minor Build Revision
----- ----- ----- --------
5 1 17763 3770
Debug: Get-PnPListItem
I noticed that running with Powershell 7 works also in PSU, but some other parts of the script do require the old AzureAD module that can only run in PS 5.1.
Help would be much appreciated.
BR
Fabian