Forum Discussion
Dzej27
Mar 02, 2021Copper Contributor
Select-Object -Property
Hi everOne!
I'm completely beginner in this field saying "PowerShell"
And maybe it could be a stupid question but like someone said "stupid question doesn't exist" soo , here i am 😜
I have a small question: Please explain me one thing : When we using "Select-Object" - and selecting by -Property so, how will I know whats available property i can choose from? For example we choosing -Property from Wim-Object from HardDisk like
DeviceID, DriveType, VolumeName, FreeSpaceGB, Capacity, DriveType - how can i see this available list?
Thanks in advice dear DevOps!
Greeting, Jacob :=> )
Hi Jacob,
There is no silly, question you are welcome to ask what you want, we all been through the learning process.
There is a nice command in PowerShell called, Get-Member
You can use it after a pipeline of any command, and you will get all the property and methods.
for example. theGet-WMIObject -class Win32_operatingsystem
will return only few information about the OperatingSystem class.
but if you need to know more and other property, you will Pipeline the command to | Get-Member so it will be like
Get-WMIObject -class Win32_operatingsystem | Get-Member
from here you can know what are the available things you can place in your select.
I recommend having also a look at the different between the Property and Method.
Enjoy
-----------------
If this answer help, please click on best response.
2 Replies
Sort By
- farismalaebSteel Contributor
Hi Jacob,
There is no silly, question you are welcome to ask what you want, we all been through the learning process.
There is a nice command in PowerShell called, Get-Member
You can use it after a pipeline of any command, and you will get all the property and methods.
for example. theGet-WMIObject -class Win32_operatingsystem
will return only few information about the OperatingSystem class.
but if you need to know more and other property, you will Pipeline the command to | Get-Member so it will be like
Get-WMIObject -class Win32_operatingsystem | Get-Member
from here you can know what are the available things you can place in your select.
I recommend having also a look at the different between the Property and Method.
Enjoy
-----------------
If this answer help, please click on best response.
- Dzej27Copper Contributor
farismalaeb Thanks a lot ! : ))))