Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.comp.os.windows-11 > #18388

Re: I need help with powershell select object

From Paul <nospam@needed.invalid>
Newsgroups alt.comp.os.windows-11
Subject Re: I need help with powershell select object
Date 2025-04-10 00:18 -0400
Organization A noiseless patient Spider
Message-ID <vt7gqk$27shn$1@dont-email.me> (permalink)
References <vt7avq$1hkgt$5@dont-email.me>

Show all headers | View raw


On Wed, 4/9/2025 10:38 PM, T wrote:
> Hi All,
> 
> powershell "Get-WmiObject -Class Win32_LogicalDisk"
> 
> DeviceID     : C:
> DriveType    : 3
> ProviderName :
> FreeSpace    : 32270856192
> Size         : 63838412800
> VolumeName   : Root
> ...
> DeviceID     : J:
> DriveType    : 4
> ProviderName : \\192.168.255.10\OurStuff
> FreeSpace    : 150684667904
> Size         : 973794349056
> VolumeName   : Fedora, 4.21.4
> 
> 
> I am after a chart that look like this:
> 
> powershell "Get-WmiObject -Class Win32_LogicalDisk | Select-Object -Property VolumeName, DeviceID, ProviderName, FreeSpace"
> 
> VolumeName              DeviceID ProviderName                 FreeSpace
> ----------              -------- ------------                 ---------
> Root                    C:                                  32270856192
> CCCOMA_X64FRE_EN-US_DV9 D:                                            0
> BACKUP                  E:                                     58589184
>                         F:
> Fedora, 4.21.4          J:       \\192.168.255.10\OurStuff 150684913664
> Fedora, 4.21.4          K:       \\RN6\CDs                 150684905472
> OurStuff                N:                                 150684917760
> 
> 
> 
> But if I add "size", I get this:
> 
> powershell "Get-WmiObject -Class Win32_LogicalDisk | Select-Object -Property VolumeName, DeviceID, ProviderName, FreeSpace, size"
> 
> 
> VolumeName   :
> DeviceID     : C:
> ProvidesName :
> FreeSpace    : 32270962688
> size         : 63838412800
> ...
> 
> What am I doing wrong?
> -T

Get-WmiObject -Class Win32_LogicalDisk | Select-Object DeviceID, FreeSpace, Size

DeviceID   FreeSpace         Size
--------   ---------         ----
C:       34660368384 127481671680
H:       71373815808 138510688256
S:       43187482624 732331765760

Get-WmiObject -Class Win32_LogicalDisk | Format-Table VolumeName, DeviceID, ProviderName, FreeSpace, Size -Autosize

VolumeName DeviceID ProviderName   FreeSpace         Size
---------- -------- ------------   ---------         ----
W11HOME    C:                    34634596352 127481671680
WIN10AMD   H:                    71373815808 138510688256
SHARED     S:                    43187482624 732331765760

Almost like there is a columnar limitation on output, which for
some commands is not evident. Your command was likely doing
AutoSize implicitly as well.

Get-WmiObject -Class Win32_LogicalDisk | Format-Table Name,Caption,Purpose,Site,Access,BlockSize,Size,FreeSpace

Name Caption Purpose Site Access BlockSize         Size   FreeSpace
---- ------- ------- ---- ------ ---------         ----   ---------
C:   C:                        0           127481671680 34634452992
H:   H:                        0           138510688256 71373815808
S:   S:                        0           732331765760 43187482624

The Format-Table seems to work to a pretty wide output.

Get-WmiObject -Class Win32_LogicalDisk | Format-Table Name,Caption,Purpose,Site,Access,BlockSize,Size,FreeSpace,Path

Name Caption Purpose Site Access BlockSize         Size   FreeSpace Path
---- ------- ------- ---- ------ ---------         ----   --------- ----
C:   C:                        0           127481671680 34634444800 \\WALLACE\root\cimv2:Win32_LogicalDisk.DeviceID="C:"
H:   H:                        0           138510688256 71373815808 \\WALLACE\root\cimv2:Win32_LogicalDisk.DeviceID="H:"
S:   S:                        0           732331765760 43187482624 \\WALLACE\root\cimv2:Win32_LogicalDisk.DeviceID="S:"

If you do this, you get all of them.

Get-WmiObject -Class Win32_LogicalDisk | Select-Object -Property *

   Paul

Back to alt.comp.os.windows-11 | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

I need help with powershell select object T <T@invalid.invalid> - 2025-04-09 19:38 -0700
  Re: I need help with powershell select object Paul <nospam@needed.invalid> - 2025-04-10 00:18 -0400
    Re: I need help with powershell select object T <T@invalid.invalid> - 2025-04-09 22:59 -0700
    Re: I need help with powershell select object T <T@invalid.invalid> - 2025-04-09 23:06 -0700
      Re: I need help with powershell select object Paul <nospam@needed.invalid> - 2025-04-10 06:37 -0400
        Re: I need help with powershell select object Andy Burns <usenet@andyburns.uk> - 2025-04-10 11:42 +0100
          Re: I need help with powershell select object Frank Slootweg <this@ddress.is.invalid> - 2025-04-10 15:30 +0000
            Re: I need help with powershell select object Andy Burns <usenet@andyburns.uk> - 2025-04-10 17:33 +0100
        Re: I need help with powershell select object T <T@invalid.invalid> - 2025-04-10 04:12 -0700
        Re: I need help with powershell select object T <T@invalid.invalid> - 2025-04-10 04:13 -0700
        Re: I need help with powershell select object Java Jive <java@evij.com.invalid> - 2025-04-10 12:46 +0100
        Re: I need help with powershell select object T <T@invalid.invalid> - 2025-04-10 17:32 -0700
    Re: I need help with powershell select object T <T@invalid.invalid> - 2025-04-10 17:43 -0700
      Re: I need help with powershell select object Paul <nospam@needed.invalid> - 2025-04-10 21:27 -0400

csiph-web