budget USD40 , simple ps script for non IT guy to export folder size

Job ID: 31776196

Budget: $30 – $250 USD

1. start from squash , in windows 10 (basic) , how to connect via powershell, e.g. install powershell module
2. a sample found online, but I need more column (data) to export, namely
full path , folder size , directory level (1,2,3...) , permissions
3. the sharepoint site is huge, what parameters I should be aware when using the ps script.
4. how should I read the error if there is any
5. how can I be sure the export is ended without problem
6. a step-by-step document to show all above so that a non-IT person can easily follow to do the export.
Thanks.

Sample found online:
#Parameters
$SiteURL = https://XXXltd.sharepoint.com/sites/se
$ListName = "Shared Documents"
$CSVFile = "C:\Users\Admin\Downloads\ExportFile.csv"
Try {
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -UseWebLogin

#Get all folders from the document library
$Folders = Get-PnPListItem -List $ListName -PageSize 2000 | Where { $_.FileSystemObjectType -eq "Folder" }

#Calculate Folder Size from files
$FolderSizeData = @()
$Folders | ForEach-Object {
#Extract Folder Size data
$FolderSizeData += New-Object PSObject -Property ([Ordered]@{
"Folder Name" = $_.FieldValues.FileLeafRef
"URL" = $_.FieldValues.FileRef
"Size" = $_.FieldValues.SMTotalSize.LookupId
})
}
$FolderSizeData | Format-Table
$FolderSizeData | Export-csv $CSVFile -NoTypeInformation
#Calculate the Total Size of Folders
$FolderSize = [Math]::Round((($FolderSizeData | Measure-Object -Property "Size" -Sum | Select-Object -expand Sum)/1KB),2)
Write-host -f Green ("Total Size: {0}" -f $FolderSize)
}
Catch {
Write-Host -f Red "Error:"$_.Exception.Message
}


#Read more: https://www.sharepointdiary.com/2018/06/sharepoint-online-get-folder-size-using-powershell.html#ixzz78xn0Jnw8
Related categories: Sharepoint Powershell