Real-Time Insights: See/Alert-on Used Disk Space

I've had a few requests for the ability to see Disk Info within Real-Time Insights and then alert on it, based on the configured thresholds.

Right now, the only Disk reporting we have is for Disk Utilization, however seeing how much space is available and where the space is allocated (similar to how we can see the application list) would be a nice improvement.

I'm guessing we could pull the info easily enough with PowerShell, but being able to utilize the Azure Arc agent to gather the info could work as well.

 

Example PowerShell Queries

Space Summary

$OSDrive = (Get-CimInstance Win32_OperatingSystem).SystemDrive
$drive = Get-PSDrive -PSProvider FileSystem -Name $OSDrive.TrimEnd(':')

[PSCustomObject]@{
    Drive      = $drive.Name
    UsedGB     = [math]::Round(($drive.Used/1GB),2)
    FreeGB     = [math]::Round(($drive.Free/1GB),2)
    TotalGB    = [math]::Round(($drive.Used + $drive.Free)/1GB,2)
    PercentUsed= [math]::Round(($drive.Used / ($drive.Used + $drive.Free)*100),2)
}

 

Top Ten largest files

$OSDrive = (Get-CimInstance Win32_OperatingSystem).SystemDrive
Get-ChildItem -Path "$OSDrive\" -Recurse -File -ErrorAction SilentlyContinue | 
Sort-Object Length -Descending | 
Select-Object FullName, @{Name="Size(GB)";Expression={[math]::Round($_.Length/1GB,2)}} -First 10

 

 

 

0

Comments (0 comments)

Please sign in to leave a comment.