Skip to content

Instantly share code, notes, and snippets.

@kdu2
Created September 13, 2018 21:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kdu2/6e98af50224682cda5ffb9f902f310cc to your computer and use it in GitHub Desktop.
Save kdu2/6e98af50224682cda5ffb9f902f310cc to your computer and use it in GitHub Desktop.
Find large portability archives over 100MB
param([string]$profiles="\\server\profiles")
$portability = Get-ChildItem -Path $profiles -Recurse -Include *.7z | where { $_.Length/1MB -gt 100 }
$archives = @()
foreach ($archive in $portability) {
$archive_temp = @()
$archive_temp = New-Object System.Object
$archivepath = $archive.fullname.split('\')
$user = $archivepath[$archivepath.Length - 3]
$archive_temp | Add-Member -MemberType NoteProperty -Name User -Value $user
$archive_temp | Add-Member -MemberType NoteProperty -Name File -Value $archive.name
$archive_temp | Add-Member -MemberType NoteProperty -Name Size_MB -Value ($archive.length/1MB).ToString("0.00")
$archives += $archive_temp
}
$archives | Export-Csv archives.csv -Force -NoTypeInformation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment