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 in Chapter 2, Learning Basic PowerCLI Concepts. First, we create a string "Learning PowerCLI"
and put it in a variable called $String
. Then, we take this $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 single line, as follows:
PowerCLI C:\> "Learning PowerCLI" | Get-Member
The output will be the following:
TypeName: System.String Name MemberType Definition ---- ---------- ---------- Clone Method System.Object Clone(), Syst... CompareTo Method int CompareTo(System.Object... Contains Method ...