I want to write a powershell script that gives the actual size on disk of a list of files. i know (Get-Item filename).length will give you the size. But this is the size of the file and not the actual space it takes on the disk.
You can do this using the Net Platform Invoke (P/Invoke) feature and call the Win32 function GetCompressedFileSizeW to get the actual size of the file.
Check this article: Powershell to get actual size on disk of a file