In: Computer Science
For this assignment, you will need any computer running PowerShell v5 or later. Your answer should only include the function or the script files that generate the results.
script.ps1
************
$path = "C:\Windows\System32"
$destination = "C:\Users\Administrator\Desktop\output.txt"
$results = Get-ChildItem $path -Recurse | where {$_.extension
-in ".dll",".exe"} | Where-Object {$_.length/1MB -gt 5} |
Select-Object Name, Extension, @{Name="Mbytes";Expression={
"{0:N0}" -f ($_.Length / 1mb) }}
$results | Sort-Object -Property extension | Out-File
$destination
$results|group extension|select Count,Name,@{l='Total
MB';e={$_.Group | Measure-Object -Property Mbytes -Sum|select
-expand sum}}| Out-File $destination -Append
if you have any doubt then please ask me without any hesitation in
the comment section below , if you like my answer then please
thumbs up for the answer , before giving thumbs down please discuss
the question it may possible that we may understand the question
different way and we can edit and change the answers if you argue,
thanks :)