Is there a way to compute the file size of a Windows process executable using a WQL
query?
I tried the below but Powershell gave me a management exception.
SELECT Caption, ExecutablePath, CommandLine From Win32_Process, (SELECT FileSize FROM Cim_DataFile WHERE Win32_Process.ExecutablePath = Cim_DataFile.Name) as ExecutableSize WHERE ExecutablePath != ''
Output from Powershell
Get-WmiObject : Invalid query At line:1 char:14 + Get-WmiObject <<<< -Query "SELECT Caption, ExecutablePath, CommandLine From Win32_Process, (SELECT FileSize FROM Cim _DataFile WHERE Win32_Process.ExecutablePath = Cim_DataFile.Name) as ExecutableSize WHERE ExecutablePath != ''" + CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
Can anyone suggest?