Learning About Objects: Get-Member

One of the most useful cmdlets is Get-Member, which displays information about the .NET Framework object that a command returns. The information includes the type, properties, and methods of the object.

To use Get-Member, use a pipeline operator (|) to send the results of a command to Get-Member. For example:

get-service | get-member

This command reveals that Get-Service actually returns a set of System.ServiceProcess.ServiceController objects -- one for each service on the computer.

   TypeName: System.ServiceProcess.ServiceController

Name					MemberType	Definition
----					----------	----------
Name					AliasProperty Name = ServiceName
add_Disposed			Method		System.Void add_Disposed(EventHandler value)
Close					 Method		System.Void Close()
Continue				Method		System.Void Continue()
CreateObjRef			Method		System.Runtime.Remoting.ObjRef CreateObjRef(Type requestedType)
Dispose				 Method		System.Void Dispose()
Equals					Method		System.Boolean Equals(Object obj)
ExecuteCommand			Method		System.Void ExecuteCommand(Int32 command)
get_CanPauseAndContinue   Method		System.Boolean get_CanPauseAndContinue()
get_CanShutdown		 Method		System.Boolean get_CanShutdown()
get_CanStop			 Method		System.Boolean get_CanStop()
get_Container			 Method		System.ComponentModel.IContainer get_Container()
get_DependentServices	 Method		System.ServiceProcess.ServiceController[] get_DependentServices()
get_DisplayName		 Method		System.String get_DisplayName()
get_MachineName		 Method		System.String get_MachineName()
get_ServiceHandle		 Method		System.Runtime.InteropServices.SafeHandle get_ServiceHandle()
get_ServiceName		 Method		System.String get_ServiceName()
get_ServicesDependedOn	Method		System.ServiceProcess.ServiceController[] get_ServicesDependedOn()
get_ServiceType		 Method		System.ServiceProcess.ServiceType get_ServiceType()
get_Site				Method		System.ComponentModel.ISite get_Site()
get_Status				Method		System.ServiceProcess.ServiceControllerStatus get_Status()
GetHashCode			 Method		System.Int32 GetHashCode()
GetLifetimeService		Method		System.Object GetLifetimeService()
GetType				 Method		System.Type GetType()
InitializeLifetimeService Method		System.Object InitializeLifetimeService()
Pause					 Method		System.Void Pause()
Refresh				 Method		System.Void Refresh()
remove_Disposed		 Method		System.Void remove_Disposed(EventHandler value)
set_DisplayName		 Method		System.Void set_DisplayName(String value)
set_MachineName		 Method		System.Void set_MachineName(String value)
set_ServiceName		 Method		System.Void set_ServiceName(String value)
set_Site				Method		System.Void set_Site(ISite value)
Start					 Method		System.Void Start(), System.Void Start(String[] args)
Stop					Method		System.Void Stop()
ToString				Method		System.String ToString()
WaitForStatus			 Method		System.Void WaitForStatus(ServiceControllerStatus desiredStatus), System.Voi...
CanPauseAndContinue	 Property	System.Boolean CanPauseAndContinue {get;}
CanShutdown			 Property	System.Boolean CanShutdown {get;}
CanStop				 Property	System.Boolean CanStop {get;}
Container				 Property	System.ComponentModel.IContainer Container {get;}
DependentServices		 Property	System.ServiceProcess.ServiceController[] DependentServices {get;}
DisplayName			 Property	System.String DisplayName {get;set;}
MachineName			 Property	System.String MachineName {get;set;}
ServiceHandle			 Property	System.Runtime.InteropServices.SafeHandle ServiceHandle {get;}
ServiceName			 Property	System.String ServiceName {get;set;}
ServicesDependedOn		Property	System.ServiceProcess.ServiceController[] ServicesDependedOn {get;}
ServiceType			 Property	System.ServiceProcess.ServiceType ServiceType {get;}
Site					Property	System.ComponentModel.ISite Site {get;set;}
Status					Property	System.ServiceProcess.ServiceControllerStatus Status {get;}

This information looks very technical, but it is actually very practical.

For more information about the Get-Member command, type:

get-help get-member -detailed