Quick Hits: Writing to a Read-Only Property

Try to link this to List CanReceiveEmail Enable/Disable.

Learn Powershell | Achieve More

This post is less on doing something useful and more on just proving that I can do something even though PowerShell is trying to tell me that I cannot do it. That little thing is updating a property on an object that is set as Read-Only.

My example to show you how you can do something like this is by looking at $PSVersionTable which as we all know gives us some great information about what version of PowerShell that we are using.

image

I am also using this as this was an example used in our previous user group meeting in which we were shown that the properties here could not be updated.

From this object, I am going to look more at the PSVersion property which of course is an object within this object.

image

Looking at the properties of this object, we can see that each of the properties are…

View original post 195 more words

Advertisements