Search⌘ K
AI Features

Methods

Explore how to inspect and utilize methods and properties of objects in both PowerShell and Python. This lesson helps you understand the use of PowerShell's Get-Member cmdlet and Python's built-in type and dir functions to discover object attributes and methods for effective coding.

Get-Member cmdlet in PowerShell#

To introspect members of an object in PowerShell, we pass the object to the Get-Member cmdlet directly or through the pipeline.

The methods and properties of an object are also called members of the object. This is the reason behind the name of the cmdlet, for example, 'Get' (Verb) 'Member' (Noun) as per the PowerShell’s ‘Verb-Noun’ syntax of a cmdlet. Get-Member cmdlet will return the member(s) of an object passed to it.

## object as an argument to the input object parameter
Get-Member -InputObject 1

## object through the pipeline
"String" | Get-Member
...