Files
Intune/intune/Externally Sourced Remediations/Reporting/Get-DiskSpaceUsageReport/Detect-DiskSpaceUsageReport.ps1
2025-05-19 15:19:36 -04:00

13 lines
441 B
PowerShell

# Check disk space usage
$diskSpace = Get-PSDrive -PSProvider FileSystem | Select-Object Name, @{Name="Used(GB)";Expression={[math]::round($_.Used/1GB,2)}}, @{Name="Free(GB)";Expression={[math]::round($_.Free/1GB,2)}}
# Output the disk space usage
# Write-Output $diskSpace
$csvPath = "C:\temp\DiskSpaceStatus.csv"
$diskSpace | Export-Csv -Path $csvPath -NoTypeInformation
Write-Output "Disk Space status exported to $csvPath"
Exit 0