<# find-pub-files.ps1 Lists every Microsoft Publisher (.pub) file under one or more folders and saves a CSV. It only reads file names and sizes. It does not change, move or upload anything. Usage: powershell -ExecutionPolicy Bypass -File .\find-pub-files.ps1 powershell -ExecutionPolicy Bypass -File .\find-pub-files.ps1 -Path D:\,\\server\share #> param( [string[]]$Path = @((Get-PSDrive -PSProvider FileSystem | Where-Object { $_.Free -ne $null }).Root), [string]$Out = (Join-Path ([Environment]::GetFolderPath('Desktop')) 'pub-files.csv') ) $found = foreach ($p in $Path) { Write-Host "Searching $p ..." Get-ChildItem -LiteralPath $p -Filter *.pub -File -Recurse -Force -ErrorAction SilentlyContinue | Where-Object { $_.Extension -eq '.pub' } | Select-Object FullName, @{n='SizeKB';e={[math]::Round($_.Length/1KB,1)}}, LastWriteTime } $found | Sort-Object LastWriteTime -Descending | Export-Csv -NoTypeInformation -Encoding UTF8 -Path $Out Write-Host ("Found {0} .pub files. List saved to {1}" -f @($found).Count, $Out) Write-Host "Convert them to PDF, Word or PowerPoint at the PUB Converter website."