diff --git a/src/cmd/purge/scripts/onedrivePurge.ps1 b/src/cmd/purge/scripts/onedrivePurge.ps1 index dbb31c1e8..1a587d25a 100644 --- a/src/cmd/purge/scripts/onedrivePurge.ps1 +++ b/src/cmd/purge/scripts/onedrivePurge.ps1 @@ -112,10 +112,6 @@ function Purge-Library { ######## MAIN ######### -# ensure that there are no unexpanded entries in the list of parameters -$LibraryNameList = $LibraryNameList | ForEach-Object { @($_.Split(',').Trim()) } -$FolderPrefixPurgeList = $FolderPrefixPurgeList | ForEach-Object { @($_.Split(',').Trim()) } - # Setup SharePointPnP if (-not (Get-Module -ListAvailable -Name PnP.PowerShell)) { $ProgressPreference = 'SilentlyContinue' @@ -173,6 +169,10 @@ Write-Host "`nAuthenticating and connecting to $SiteUrl" Connect-PnPOnline -Url $siteUrl -Credential $cred Write-Host "Connected to $siteUrl`n" +# ensure that there are no unexpanded entries in the list of parameters +$LibraryNameList = $LibraryNameList | ForEach-Object { @($_.Split(',').Trim()) } +$FolderPrefixPurgeList = $FolderPrefixPurgeList | ForEach-Object { @($_.Split(',').Trim()) } + foreach ($library in $LibraryNameList) { Purge-Library -LibraryName $library -PurgeBeforeTimestamp $PurgeBeforeTimestamp -FolderPrefixPurgeList $FolderPrefixPurgeList -SiteSuffix $siteSiffix } \ No newline at end of file