- Powershell Core 6.2 Cookbook
- Jan Hendrik Peters
- 138字
- 2021-06-24 15:14:31
How it works...
The Get-Member cmdlet is used to find all publicly visible class members through reflection. Most of the time, these members will be properties and methods. Don't be surprised to find events here as well. Events can be used for some more advanced scripting where you would like to react to object events. This could, for example, be a FileSystemWatcher that fires an event as soon as a file is changed.
When examining the output of Get-Member, you often see in the member definition that certain members are read-only. Take the following example of a file or directory. While the full name can only be read (get;), the creation time can be modified (get;set;). Changing the FullName property is only possible by executing the MoveTo method:
FullName Property string FullName {get;}
CreationTime Property datetime CreationTime {get;set;}