In PnP PowerShell for SharePoint 2013 site, how to give credentials only once, so that it will not ask credentials again while connecting to different site collections coming from a CSV file input.
Here is the code snippet:
$SiteCollections = import-csv -path ".\Source_Destination_URLMapping.csv"
$listTitle = "variation labels"
foreach($SiteCollection in $SiteCollections)
{
Connect-PnPOnline -Url $SiteCollection.SiteUrl (get-pnplistitem -list "variation labels").count
}
$SiteCollections = import-csv -path ".\Source_Destination_URLMapping.csv" $listTitle = "variation labels" foreach($SiteCollection in $SiteCollections) { Connect-PnPOnline -Url $SiteCollection.SiteUrl (get-pnplistitem -list "variation labels").count }