Created
September 13, 2018 21:11
-
-
Save kdu2/6e98af50224682cda5ffb9f902f310cc to your computer and use it in GitHub Desktop.
Find large portability archives over 100MB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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