From the course: Complete Guide to PowerShell 7

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Creating custom objects

Creating custom objects

- [Instructor] Now as we've been through some examples, you've seen that we've created a custom object, and this is based around what's called PS custom object. The PS custom object means that we can craft whatever it would be. So this is very reminiscent of using a standard coding language and creating a class type idea where you specify what the objects would be. Now, in this instance, it means we get to define the properties and the values. So I've created a person custom object, and I've defined it as name, age, and email, and populated those values. So if I select this object here, and then I want to see what's inside of that, I can say person. Now, what's nice about a custom object is that I can tab through the various properties, and you'll see some of the methods available to me as well. But you can see age, name, email. If I choose email, it will list me the value. If I say age, it'll list me the age. So the object becomes easy for us to use because it has all the properties…

Contents