The “Get-Member” cmdlet in PowerShell gets the properties, methods, and members of objects. It is extremely helpful during the time user is working with some unknown objects. As it gives information about the available methods and properties. It has various parameters that are used to get the customized set of results.
This post will overview PowerShell’s “Get-Member” cmdlet in-depth.
How to Use the “Get-Member” (Microsoft.PowerShell.Utility) Cmdlet in PowerShell?
To get the members, methods, or properties of an object, first, place the “Get-Member” cmdlet along with the “|” pipeline and specify the cmdlet to get the members.
To understand the concept more clearly, check the given examples!
Example 1: Use the Cmdlet “Get-Member” to Retrieve the Members and the Details of Process Objects
First, specify the particular cmdlet to get the members of process objects. Then, pipe it to the “Get-Member” cmdlet:
Example 2: Use the “Get-Member” Cmdlet to Get the Extended Members of Process Objects
By using the above-provided command, add the “-View” parameter and assign it the “Extended” value to get the extended list of members:
Example 3: Use the “Get-Member” Cmdlet to Get the Members for an Array
Initially, create an array variable having the stated values. Then, place the array variable and pipe it to the “Get-Member” cmdlet:
$array | Get-Member
Example 4: Use the “Get-Member” Cmdlet to Get the Script Methods of Event Log Objects
Run the given command to retrieve the script methods of event log objects in PowerShell:
That’s all! You have learned about the cmdlet “Get-Member” with multiple examples.
Conclusion
The cmdlet “Get-Member” is used in PowerShell to retrieve the properties, methods, and members of a specified object. It also reveals the available methods and properties. This post has demonstrated the “Get-Member” cmdlet in detail.