PS C:\> Get-WmiObject Win32_LogicalDisk | Where-Object -Property DriveType -eq -Value "3" | ` ForEach-Object { $_.DeviceID, $_.FreeSpace } C: 44025641384 D: 2816375424 E: 48146688560
Is it possible to use a function with ForEach-Object? I know I can apply formatting, but I want to do other things based on the size of the disks while maintaining the driveletter/bytes association. In pseudo code it might look like this
PS C:\> Get-WmiObject Win32_LogicalDisk | Where-Object -Property DriveType -eq -Value "3" | ` ForEach-Object { $_.DeviceID, $_.FreeSpace | myfunction } C: plenty of room D: ok E: full!