Using objects, properties, and methods
In PowerCLI, even a string is an object. You can list the members of a string object using the Get-Member
cmdlet that you have seen before. Let's go back to our example from
Chapter 2
, Learning Basic PowerCLI Concepts. First, we create a string Learning PowerCLI
and put it in a variable named $String
. Then, we take the $String
variable and execute the Get-Member
cmdlet using the $String
variable as the input:
PowerCLI C:\> $String = "Learning PowerCLI" PowerCLI C:\> Get-Member -Inputobject $String
You can also use the pipeline and do it in a one-liner:
PowerCLI C:\> "Learning PowerCLI" | Get-Member
The output will be as follows:
TypeName: System.String Name MemberType Definition ---- ---------- ---------- Clone Method System.Object Clone(), Syst... CompareTo Method int CompareTo(System.Object... Contains Method bool Contains...