Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a Windows PowerShell script that will perform the following functions: Sea

ID: 3669323 • Letter: W

Question

Write a Windows PowerShell script that will perform the following functions:

Search your computer for files ending with a .doc, .docx, .xls, or .xlsx file extension.

Output the filenames and sizes (in groups by file extension) to a text file named “File_Summary.txt”. The output should also conclude with a total of the number of files and total file size for each file extension.

Include comments in the script code to document the functionality of the script.

Paste the script and the file output to your MS Word document

Explanation / Answer

$Folder_To_Check = "location where you want to check"
$Report_File_Location = "File_Summary.txt"

$results = Get-ChildItem $Folder_To_Check -Include *.doc,*.docx,*.xls,*.xlsx -Recurse
$results | Group-Object extension | ForEach-Object {
[PSCustomObject]@{
Extension = $_.Name
Count = $_.Count
Size = [Math]::Round(($_.Group | Measure-Object -Sum Length | Select-Object -ExpandProperty Sum) / 1MB,2)
}
} | Out-File $Report_File_Location -Append

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote