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


Groups > alt.comp.os.windows-11 > #18387 > unrolled thread

I need help with powershell select object

Started byT <T@invalid.invalid>
First post2025-04-09 19:38 -0700
Last post2025-04-10 21:27 -0400
Articles 14 — 5 participants

Back to article view | Back to alt.comp.os.windows-11


Contents

  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

#18387 — I need help with powershell select object

FromT <T@invalid.invalid>
Date2025-04-09 19:38 -0700
SubjectI need help with powershell select object
Message-ID<vt7avq$1hkgt$5@dont-email.me>
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

[toc] | [next] | [standalone]


#18388

FromPaul <nospam@needed.invalid>
Date2025-04-10 00:18 -0400
Message-ID<vt7gqk$27shn$1@dont-email.me>
In reply to#18387
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

[toc] | [prev] | [next] | [standalone]


#18389

FromT <T@invalid.invalid>
Date2025-04-09 22:59 -0700
Message-ID<vt7mn7$1hkh7$1@dont-email.me>
In reply to#18388
On 4/9/25 9:18 PM, Paul wrote:
> Get-WmiObject -Class Win32_LogicalDisk | Format-Table VolumeName, DeviceID, ProviderName, FreeSpace, Size -Autosize


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

DeviceID VolumeName              ProviderName                 FreeSpace 
        Size
-------- ----------              ------------                 --------- 
        ----
C:       Root                                               32281927680 
63838412800
D:       CCCOMA_X64FRE_EN-US_DV9                                      0 
  6115186688
E:       BACKUP                                                58589184 
    73396224
F:
J:       Fedora, 4.21.4          \\192.168.255.10\OurStuff 150682517504 
973794349056
K:       Fedora, 4.21.4          \\RN6\CDs                 150682509312 
973794349056
N:       OurStuff                                          150682517504 
973794349056



Thank you!

The "ProviderName" is giving me the network UNC path.

The "-Autosize" is going to be interesting to figure out,
but it is doable.

[toc] | [prev] | [next] | [standalone]


#18390

FromT <T@invalid.invalid>
Date2025-04-09 23:06 -0700
Message-ID<vt7n5p$1hkgt$6@dont-email.me>
In reply to#18388
On 4/9/25 9:18 PM, Paul wrote:
> Get-WmiObject -Class Win32_LogicalDisk | Format-Table VolumeName, DeviceID, ProviderName, FreeSpace, Size -Autosize


Just out of curiosity, what is "DriveType    : 4"?

[toc] | [prev] | [next] | [standalone]


#18394

FromPaul <nospam@needed.invalid>
Date2025-04-10 06:37 -0400
Message-ID<vt870o$2qqsd$1@dont-email.me>
In reply to#18390
On Thu, 4/10/2025 2:06 AM, T wrote:
> On 4/9/25 9:18 PM, Paul wrote:
>> Get-WmiObject -Class Win32_LogicalDisk | Format-Table VolumeName, DeviceID, ProviderName, FreeSpace, Size -Autosize
> 
> 
> Just out of curiosity, what is "DriveType    : 4"?

When Microsoft does that, you'll need to find an article
with the secret decoder ring.

Remember, that historically, Microsoft hasn't known what your storage
device is. On this machine, it calls my RAMDrive "Fiber channel" (that's the
name this week). I'm sure one of the storage types is "Station wagon full of 9 track tape".

https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-logicaldisk

DriveType

Unknown (0)
No Root Directory (1)
Removable Disk (2)
Local Disk (3)
Network Drive (4)
Compact Disc (5)
RAM Disk (6)

And you can tell that list is not even remotely up to date.
There are bound to be new values, undocumented.

For example "Stone Tablet and Chisel" is missing.

Get-WmiObject -Class Win32_LogicalDisk | Format-Table VolumeName, DriveType

VolumeName DriveType
---------- ---------
W11HOME            3
RAMDrive           3   <=== See, it blends right in.
WIN10AMD           3
SHARED             3

Task Manager performance tab, lists the RAMDrive as Fiber Channel.
The Optimize dialog calls it "HDD" this week, which means
I can defrag the RAMDrive if I want.

   Paul

[toc] | [prev] | [next] | [standalone]


#18395

FromAndy Burns <usenet@andyburns.uk>
Date2025-04-10 11:42 +0100
Message-ID<m5pljuF95lfU1@mid.individual.net>
In reply to#18394
Paul wrote:

> Remember, that historically, Microsoft hasn't known what your storage
> device is. 
> 
> https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32- 
> logicaldisk
> 
> DriveType
> 
> Unknown (0)
> No Root Directory (1)
> Removable Disk (2)
> Local Disk (3)
> Network Drive (4)
> Compact Disc (5)
> RAM Disk (6)

My google G: drive can't admit it's a #4 network drive, it says it's a 
#3 local drive.

[toc] | [prev] | [next] | [standalone]


#18402

FromFrank Slootweg <this@ddress.is.invalid>
Date2025-04-10 15:30 +0000
Message-ID<vt8v68.u7o.1@ID-201911.user.individual.net>
In reply to#18395
Andy Burns <usenet@andyburns.uk> wrote:
> Paul wrote:
> 
> > Remember, that historically, Microsoft hasn't known what your storage
> > device is. 
> > 
> > https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32- 
> > logicaldisk
> > 
> > DriveType
> > 
> > Unknown (0)
> > No Root Directory (1)
> > Removable Disk (2)
> > Local Disk (3)
> > Network Drive (4)
> > Compact Disc (5)
> > RAM Disk (6)
> 
> My google G: drive can't admit it's a #4 network drive, it says it's a 
> #3 local drive.

  Well, I think that's somewhat 'correct'. It's not a Network Drive
(note case), because that's a drive letter which is mapped to a
*Windows* (i.e. SMB) Network Share and Google Drive isn't a Network
Share. Also a Network Drive has no content on your local disk, but
Google Drive can/does have content on your local disk [1].

  So I think, 'Local Disk' is more 'correct' or less 'wrong' than
'Network Drive'.

[1] At least when the syncing option is set to 'Mirror files'. But also
for 'Streaming files', it says it "uses less hard drive space", less,
not no. FWIW, I use 'Mirror files'.

[toc] | [prev] | [next] | [standalone]


#18403

FromAndy Burns <usenet@andyburns.uk>
Date2025-04-10 17:33 +0100
Message-ID<m5qa7cFccqjU1@mid.individual.net>
In reply to#18402
Frank Slootweg wrote:

> Andy Burns wrote:
>
>> My google G: drive can't admit it's a #4 network drive, it says it's a
>> #3 local drive.
> 
> I think, 'Local Disk' is more 'correct' or less 'wrong' than
> 'Network Drive'.
The S3 drive (variously by Callback Technologies or /n Software 
depending whether it's the free or paid version I'm using) does report as #4

DeviceID     : S:
DriveType    : 4
ProviderName : \\s3.eu-west-1...\Amazon S3

[toc] | [prev] | [next] | [standalone]


#18396

FromT <T@invalid.invalid>
Date2025-04-10 04:12 -0700
Message-ID<vt893c$2pfqc$1@dont-email.me>
In reply to#18394
On 4/10/25 3:37 AM, Paul wrote:
> On Thu, 4/10/2025 2:06 AM, T wrote:
>> On 4/9/25 9:18 PM, Paul wrote:
>>> Get-WmiObject -Class Win32_LogicalDisk | Format-Table VolumeName, DeviceID, ProviderName, FreeSpace, Size -Autosize
>>
>>
>> Just out of curiosity, what is "DriveType    : 4"?
> 
> When Microsoft does that, you'll need to find an article
> with the secret decoder ring.
> 
> Remember, that historically, Microsoft hasn't known what your storage
> device is. On this machine, it calls my RAMDrive "Fiber channel" (that's the
> name this week). I'm sure one of the storage types is "Station wagon full of 9 track tape".
> 
> https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-logicaldisk
> 
> DriveType
> 
> Unknown (0)
> No Root Directory (1)
> Removable Disk (2)
> Local Disk (3)
> Network Drive (4)
> Compact Disc (5)
> RAM Disk (6)
> 
> And you can tell that list is not even remotely up to date.
> There are bound to be new values, undocumented.
> 
> For example "Stone Tablet and Chisel" is missing.
> 
> Get-WmiObject -Class Win32_LogicalDisk | Format-Table VolumeName, DriveType
> 
> VolumeName DriveType
> ---------- ---------
> W11HOME            3
> RAMDrive           3   <=== See, it blends right in.
> WIN10AMD           3
> SHARED             3
> 
> Task Manager performance tab, lists the RAMDrive as Fiber Channel.
> The Optimize dialog calls it "HDD" this week, which means
> I can defrag the RAMDrive if I want.
> 
>     Paul

Thank you!

[toc] | [prev] | [next] | [standalone]


#18397

FromT <T@invalid.invalid>
Date2025-04-10 04:13 -0700
Message-ID<vt895m$2pfqc$2@dont-email.me>
In reply to#18394
On 4/10/25 3:37 AM, Paul wrote:
> Local Disk (3)

Hmmm.  My WinFSP share from my host machine is a "local disk"?

[toc] | [prev] | [next] | [standalone]


#18398

FromJava Jive <java@evij.com.invalid>
Date2025-04-10 12:46 +0100
Message-ID<vt8b32$2u6or$1@dont-email.me>
In reply to#18394
On 2025-04-10 11:37, Paul wrote:
>
> For example "Stone Tablet and Chisel" is missing.

LOL!

-- 

Fake news kills!

I may be contacted via the contact address given on my website: 
www.macfh.co.uk

[toc] | [prev] | [next] | [standalone]


#18407

FromT <T@invalid.invalid>
Date2025-04-10 17:32 -0700
Message-ID<vt9nvm$2qfn$1@dont-email.me>
In reply to#18394
On 4/10/25 3:37 AM, Paul wrote:
> On Thu, 4/10/2025 2:06 AM, T wrote:
>> On 4/9/25 9:18 PM, Paul wrote:
>>> Get-WmiObject -Class Win32_LogicalDisk | Format-Table VolumeName, DeviceID, ProviderName, FreeSpace, Size -Autosize
>>
>>
>> Just out of curiosity, what is "DriveType    : 4"?

> https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-logicaldisk

Yikes!  I'd hate to program that!!!


> Unknown (0)
> No Root Directory (1)
> Removable Disk (2)
> Local Disk (3)
> Network Drive (4)
> Compact Disc (5)
> RAM Disk (6)

Thank you!

[toc] | [prev] | [next] | [standalone]


#18408

FromT <T@invalid.invalid>
Date2025-04-10 17:43 -0700
Message-ID<vt9oj9$2qfn$2@dont-email.me>
In reply to#18388
On 4/9/25 9:18 PM, Paul wrote:
> 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,

It is the word "Size", even by itself, than goofs it.

Perhaps I stumbles on a "reserved word"?  Those are always a
pain-in-the-neck when you stumble across them in your
programming language.


[toc] | [prev] | [next] | [standalone]


#18409

FromPaul <nospam@needed.invalid>
Date2025-04-10 21:27 -0400
Message-ID<vt9r5n$9jh2$1@dont-email.me>
In reply to#18408
On Thu, 4/10/2025 8:43 PM, T wrote:
> On 4/9/25 9:18 PM, Paul wrote:
>> 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,
> 
> It is the word "Size", even by itself, than goofs it.
> 
> Perhaps I stumbles on a "reserved word"?  Those are always a
> pain-in-the-neck when you stumble across them in your
> programming language.

Playing with it, it looks like "Format-Table" supports wider tables.
The -Autosize, it's good to know such an option exists, but I think
it is the default action and does not need to be included.

   Paul

[toc] | [prev] | [standalone]


Back to top | Article view | alt.comp.os.windows-11


csiph-web