Below script can be used to find the size of spam Mails folder in the User mailbox for the given list of users. Export list of users from the server throught below command and input into the Name.txt and Execute
Get-mailbox | Where{$_.Servername -eq “Servername”} | select-object Alias > c:\Names.txt
$UserList = Get-Content “C:\Names.txt”
foreach($user in $UserList)
{
$Spamsize = get-mailboxfolderstatistics $user | Where {$_.Name -match “Spam”} | select FolderAndSubfolderSize
$output = $user + ” ” + $spamsize.FolderAndSubfolderSize/1mb
Write-output $output
}