Complete the code to list all files in the current directory.
Get-ChildItem [1]The -Path . option tells PowerShell to list files in the current directory.
Complete the code to export the list of files to a CSV file named report.csv.
Get-ChildItem -Path . | [1] -Path report.csvExport-Csv exports objects to a CSV file, perfect for reports.
Fix the error in the code to filter files larger than 1MB.
Get-ChildItem -Path . | Where-Object { $_.Length [1] 1MB }In PowerShell, -gt means 'greater than' and is used in script blocks.
Fill both blanks to create a hashtable with file names as keys and sizes as values for files modified in the last 7 days.
$fileSizes = @{}
Get-ChildItem -Path . | Where-Object { $_.LastWriteTime [1] (Get-Date).AddDays(-7) } | ForEach-Object { $fileSizes[[2]] = $_.Length }Use -gt to filter files modified in the last 7 days and $_.Name as the hashtable key since $_ refers to the current file object in the ForEach-Object pipeline.
Fill all three blanks to create a report dictionary with uppercase file names as keys, sizes as values, and only include files larger than 500KB.
$report = @{}
foreach ($file in Get-ChildItem -Path . | Where-Object { $file.Length [3] 500KB }) {
$report[[1]] = [2]
}Keys are uppercase file names ($file.Name.ToUpper()), values are sizes ($file.Length), and filter uses -gt for 'greater than'.