diff --git a/reference/3.0/Microsoft.PowerShell.Utility/Get-Member.md b/reference/3.0/Microsoft.PowerShell.Utility/Get-Member.md index ac5a326b9295..954078f45989 100644 --- a/reference/3.0/Microsoft.PowerShell.Utility/Get-Member.md +++ b/reference/3.0/Microsoft.PowerShell.Utility/Get-Member.md @@ -102,21 +102,11 @@ This command gets the methods and properties of service objects that were extend The Get-Member command uses the View parameter to get only the extended members of the service objects. In this case, the extended member is the Name property, which is an alias property of the ServiceName property. ### Example 4 -``` -PS C:\> get-eventlog -log system | gm -membertype scriptproperty -TypeName: System.Diagnostics.EventLogEntry +```powershell +PS C:\> Get-EventLog -Log System | Get-Member -MemberType ScriptProperty -Name MemberType Definition ----- ---------- ---------- -EventID ScriptProperty System.Object EventID {get=$this.get_EventID() -band 0xFFFF;} -``` -This command gets the script properties of event log objects in the System log in Event Viewer. -In this case, the only script property is the EventID. -### Example 5 -``` -PS C:\> get-eventlog -log system | get-member -membertype scriptproperty -TypeName: System.Diagnostics.EventLogEntry + TypeName: System.Diagnostics.EventLogEntry Name MemberType Definition ---- ---------- ---------- @@ -124,11 +114,10 @@ EventID ScriptProperty System.Object EventID {get=$this.get_EventID() -band 0xFF ``` This command gets the script properties of event log objects in the System log in Event Viewer. +The command uses the **MemberType** parameter to get only objects with a value of ScriptProperty for their MemberType property. +The command returns the EventID property of the **EventLog** object. -The command uses the MemberType parameter to get only objects with a value of AliasProperty for their MemberType property. - -The command returns the EventID property of the EventLog object. -### Example 6 +### Example 5 ``` PS C:\> $a = "get-process", "get-service", "get-culture", "get-psdrive", "get-executionpolicy" PS C:\> foreach ($cmdlet in $a) {invoke-command $cmdlet | get-member -name machinename} @@ -152,7 +141,7 @@ The first command stores the names of several cmdlets in the $a variable. The second command uses a ForEach statement to invoke each command, send the results to Get-Member, and limit the results from Get-Member to members that have the name "MachineName." The results show that only process objects (System.Diagnostics.Process) and service objects (System.ServiceProcess.ServiceController) have a MachineName property. -### Example 7 +### Example 6 ``` PS C:\> $a = get-member -inputobject @(1) PS C:\> $a.count @@ -179,7 +168,7 @@ In this case, the array contains only one object, the integer 1. The third command uses the Get-Member cmdlet to get the properties and methods of an array of integers, and the command saves them in the $a variable. The fourth command uses the Count property of the array to find the number of objects in the $a variable. -### Example 8 +### Example 7 ``` PS C:\> $file = get-item c:\test\textFile.txt PS C:\> $file.psobject.properties | where-object {$_.issettable} | format-table -property name @@ -212,7 +201,7 @@ The first command uses the Get-Item cmdlet to get a text file, and then it saves The second command gets all of the changeable properties of the file object in the $file variable and displays the names of the properties in a table. The third command gets the changeable properties of all objects in your Windows PowerShell session. -### Example 9 +### Example 8 ``` PS C:\> $s = get-service PS C:\> $s | get-member diff --git a/reference/4.0/Microsoft.PowerShell.Utility/Get-Member.md b/reference/4.0/Microsoft.PowerShell.Utility/Get-Member.md index 7ebb1097c633..48eb34b9689e 100644 --- a/reference/4.0/Microsoft.PowerShell.Utility/Get-Member.md +++ b/reference/4.0/Microsoft.PowerShell.Utility/Get-Member.md @@ -108,22 +108,11 @@ The Get-Member command uses the View parameter to get only the extended members In this case, the extended member is the Name property, which is an alias property of the ServiceName property. ### Example 4 -``` -PS C:\> get-eventlog -log system | gm -membertype scriptproperty -TypeName: System.Diagnostics.EventLogEntry +```powershell +PS C:\> Get-EventLog -Log System | Get-Member -MemberType ScriptProperty -Name MemberType Definition ----- ---------- ---------- -EventID ScriptProperty System.Object EventID {get=$this.get_EventID() -band 0xFFFF;} -``` -This command gets the script properties of event log objects in the System log in Event Viewer. -In this case, the only script property is the EventID. - -### Example 5 -``` -PS C:\> get-eventlog -log system | get-member -membertype scriptproperty -TypeName: System.Diagnostics.EventLogEntry + TypeName: System.Diagnostics.EventLogEntry Name MemberType Definition ---- ---------- ---------- @@ -131,12 +120,10 @@ EventID ScriptProperty System.Object EventID {get=$this.get_EventID() -band 0xFF ``` This command gets the script properties of event log objects in the System log in Event Viewer. +The command uses the **MemberType** parameter to get only objects with a value of ScriptProperty for their MemberType property. +The command returns the EventID property of the **EventLog** object. -The command uses the MemberType parameter to get only objects with a value of AliasProperty for their MemberType property. - -The command returns the EventID property of the EventLog object. - -### Example 6 +### Example 5 ``` PS C:\> $a = "get-process", "get-service", "get-culture", "get-psdrive", "get-executionpolicy" PS C:\> foreach ($cmdlet in $a) {invoke-command $cmdlet | get-member -name machinename} @@ -161,7 +148,7 @@ The second command uses a ForEach statement to invoke each command, send the res The results show that only process objects (System.Diagnostics.Process) and service objects (System.ServiceProcess.ServiceController) have a MachineName property. -### Example 7 +### Example 6 ``` PS C:\> $a = get-member -inputobject @(1) PS C:\> $a.count @@ -189,7 +176,7 @@ The third command uses the Get-Member cmdlet to get the properties and methods o The fourth command uses the Count property of the array to find the number of objects in the $a variable. -### Example 8 +### Example 7 ``` PS C:\> $file = get-item c:\test\textFile.txt PS C:\> $file.psobject.properties | where-object {$_.issettable} | format-table -property name @@ -223,7 +210,7 @@ The second command gets all of the changeable properties of the file object in t The third command gets the changeable properties of all objects in your Windows PowerShell session. -### Example 9 +### Example 8 ``` PS C:\> $s = get-service PS C:\> $s | get-member