Exchange structured inventory and audit data between PowerShell and spreadsheet tools.
Sheet: 15 of 25 | Platform: Windows 10/11 | Shell: PowerShell 7.x and Windows PowerShell 5.1 (unless marked otherwise) | Editorial review: November 24, 2026
Examples use the MGU project root and illustrative staging, backup, and download paths. Replace them with existing, approved paths as needed. Unless explicitly marked as a continuation, examples are independent. Read commands before running them; commands that write or modify files can change existing data.
Quick commands
1. Export file inventory columns
Get-ChildItem -LiteralPath 'C:\MGU' -Recurse -File -Filter '*.html' |
Select-Object FullName, Length, CreationTime, LastWriteTime |
Export-Csv -LiteralPath 'C:\MGU-Staging\inventory.csv' -NoTypeInformation -Encoding UTF8
2. Import a CSV as objects
$rows = Import-Csv -LiteralPath 'C:\MGU-Staging\inventory.csv' -Encoding UTF8
$rows | Select-Object -First 5
3. Filter numeric columns with explicit conversion
Import-Csv -LiteralPath 'C:\MGU-Staging\inventory.csv' -Encoding UTF8 |
Where-Object { [long]$_.Length -gt 10KB }
4. Export tab-delimited data
Get-ChildItem -LiteralPath 'C:\MGU' -File |
Select-Object FullName, Length |
Export-Csv -LiteralPath 'C:\MGU-Staging\files.tsv' -Delimiter "`t" -NoTypeInformation -Encoding UTF8
5. Count imported records
(Import-Csv -LiteralPath 'C:\MGU-Staging\inventory.csv' -Encoding UTF8 | Measure-Object).Count
6. Export extension summary
Get-ChildItem -LiteralPath 'C:\MGU' -Recurse -File |
Group-Object Extension | Select-Object Name, Count |
Export-Csv -LiteralPath 'C:\MGU-Staging\extensions.csv' -NoTypeInformation -Encoding UTF8
Operational notes
CSV imported values are normally strings. Use consistent columns, delimiter and encoding when appending. Do not pipe Format-Table to Export-Csv. Review untrusted cell values before opening CSVs in spreadsheet software; formulas may execute there.