The only definition of NoteProperty I've been able to find said they are properties inherited from the PowerShell environment. That doesn't really clarify what they are or how they are used. All the blog posts I've found that reference NoteProperty all seem to assume everyone already knows what they are. "NoteProperty" is even missing from the TechNet PowerShell Glossary.
What is a NoteProperty and how does that differ from a normal property?
A script property defines a property whose value is the output of a script. In the following example, the VersionInfo property is added to the System. IO. FileInfo type. The ScriptProperty element defines the extended property as a script property.
The Get-Member command uses the Force parameter to add the intrinsic members and compiler-generated members of the objects to the display. You can use these properties and methods in the same way that you would use an adapted method of the object.
Under the hood, all PowerShell objects are PSObject objects All objects that are created in a PowerShell session, be they . NET types, COM objects or the explicit «void» object PSCustomObject , are wrapped into a PSObject, which itself is implemented in the . NET type System. Management. Automation.
PSCustomObject is a great tool to add into your PowerShell tool belt. Let's start with the basics and work our way into the more advanced features. The idea behind using a PSCustomObject is to have a simple way to create structured data. Take a look at the first example and you'll have a better idea of what that means.
NoteProperties are generic properties that are created by Powershell (as opposed to properties that are inherited from a specific dotnet object type).
Properties of PS custom objects will be NoteProperty, as will the properties of objects created with Import-CSV, or created by using Select-Object and specifying properties to select.
NoteProperty A property of the object with a static value. Note that properties are defined as a name-value pair, such as "Color=Blue".
Usualy this is use to add a property to a pscustomobject using add-member
see PSMemberTypeEnumeration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With