Mittwoch, 5. Juli 2017, 22:55 Uhr

Properties und Methoden eines PowerShell-Objektes anzeigen

Ich programmiere zwar seit einigen Jahren hie und da PowerShell-Scripts, aber bis heute wusste ich nicht, dass man Properties und Methoden eines PowerShell-Objektes derart einfach ausgeben kann. Die Web-Site msXfaq.de half weiter.

Properties

$var = Get-Date
$var | fl *
DisplayHint : DateTime
DateTime    : Dienstag, 29. Oktober 2013 00:16:08
Date        : 29.10.2013 00:00:00
Day         : 29
DayOfWeek   : Tuesday
DayOfYear   : 302
Hour        : 0
Kind        : Local
Millisecond : 229
Minute      : 16
Month       : 10
Second      : 8
Ticks       : 635186025682291672
TimeOfDay   : 00:16:08.2291672
Year        : 2013

Methoden

$var = Get-Date
$var | gm *
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), int CompareTo(datetime value), int IComparable.CompareTo..
Equals               Method         bool Equals(System.Object value), bool Equals(datetime value), bool IEquatable[datetime].Equ..
IsDaylightSavingTime Method         bool IsDaylightSavingTime()
Subtract             Method         timespan Subtract(datetime value), datetime Subtract(timespan value)
ToFileTime           Method         long ToFileTime()
ToFileTimeUtc        Method         long ToFileTimeUtc()
ToLocalTime          Method         datetime ToLocalTime()
ToLongDateString     Method         string ToLongDateString()
ToLongTimeString     Method         string ToLongTimeString()
ToOADate             Method         double ToOADate()
ToSByte              Method         sbyte IConvertible.ToSByte(System.IFormatProvider provider)
ToShortDateString    Method         string ToShortDateString()
ToShortTimeString    Method         string ToShortTimeString()
ToString             Method         string ToString(), string ToString(string format), string ToString(System.IFormatProvider pr..
ToUniversalTime      Method         datetime ToUniversalTime()
DisplayHint          NoteProperty   Microsoft.PowerShell.Commands.DisplayHintType DisplayHint=DateTime
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;}

Tags: , , , , ,
Labels: Programmierung

Kommentar erfassen