"Get-Member" Cmdlet in Windows PowerShell

Q

What is the "Get-Member" cmdlet in Windows PowerShell?

✍: FYIcenter.com

A

"Get-Member" cmdlet in Windows PowerShell allows you to inspect the output object by displaying its class members, including properties and methods.

For example: the following command uses "get-member" to display methods and properties supported in the DateTime output object:

PS C:\fyicenter> Get-Date | Get-Member
   TypeName: System.DateTime

Name                 MemberType     Definition
----                 ----------     ----------
Add                  Method         datetime Add(timespan value)
AddDays              Method         datetime AddDays(double value)
AddHours             Method         datetime AddHours(double value)
AddMilliseconds      Method         datetime AddMilliseconds(double value)
AddMinutes           Method         datetime AddMinutes(double value)
AddMonths            Method         datetime AddMonths(int months)
AddSeconds           Method         datetime AddSeconds(double value)
AddTicks             Method         datetime AddTicks(long value)
AddYears             Method         datetime AddYears(int value)
CompareTo            Method         int CompareTo(System.Object value), ...
Equals               Method         bool Equals(System.Object value), bool ...
GetDateTimeFormats   Method         string[] GetDateTimeFormats(), string[] ...
GetHashCode          Method         int GetHashCode()
GetObjectData        Method         void ISerializable.GetObjectData(...
GetType              Method         type GetType()
GetTypeCode          Method         System.TypeCode GetTypeCode(), ...
IsDaylightSavingTime Method         bool IsDaylightSavingTime()
Subtract             Method         timespan Subtract(datetime value), ...
ToBinary             Method         long ToBinary()
ToBoolean            Method         bool IConvertible.ToBoolean(...
ToByte               Method         byte IConvertible.ToByte(...
ToChar               Method         char IConvertible.ToChar(...
ToDateTime           Method         datetime IConvertible.ToDateTime(...
ToDecimal            Method         decimal IConvertible.ToDecimal(...
ToDouble             Method         double IConvertible.ToDouble(...
ToFileTime           Method         long ToFileTime()
ToFileTimeUtc        Method         long ToFileTimeUtc()
ToInt16              Method         int16 IConvertible.ToInt16(...
ToInt32              Method         int IConvertible.ToInt32(...
ToInt64              Method         long IConvertible.ToInt64(...
ToLocalTime          Method         datetime ToLocalTime()
ToLongDateString     Method         string ToLongDateString()
ToLongTimeString     Method         string ToLongTimeString()
ToOADate             Method         double ToOADate()
ToSByte              Method         sbyte IConvertible.ToSByte(...
ToShortDateString    Method         string ToShortDateString()
ToShortTimeString    Method         string ToShortTimeString()
ToSingle             Method         float IConvertible.ToSingle(...
ToString             Method         string ToString(), string ...
ToType               Method         System.Object IConvertible....
ToUInt16             Method         uint16 IConvertible.ToUInt16(...
ToUInt32             Method         uint32 IConvertible.ToUInt32(...
ToUInt64             Method         uint64 IConvertible.ToUInt64(...
ToUniversalTime      Method         datetime ToUniversalTime()
DisplayHint          NoteProperty   Microsoft.PowerShell.Commands....
Date                 Property       datetime Date {get;}
Day                  Property       int Day {get;}
DayOfWeek            Property       System.DayOfWeek DayOfWeek {get;}
DayOfYear            Property       int DayOfYear {get;}
Hour                 Property       int Hour {get;}
Kind                 Property       System.DateTimeKind Kind {get;}
Millisecond          Property       int Millisecond {get;}
Minute               Property       int Minute {get;}
Month                Property       int Month {get;}
Second               Property       int Second {get;}
Ticks                Property       long Ticks {get;}
TimeOfDay            Property       timespan TimeOfDay {get;}
Year                 Property       int Year {get;}
DateTime             ScriptProperty System.Object DateTime ...

 

Introduction of Windows PowerShell Cmdlet

⇒⇒Windows PowerShell Tutorials

2016-11-03, 325👍, 0💬