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 - PowerShell Tutorial
From the course: Complete Guide to PowerShell 7
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
(Locked)
Understanding PowerShell objects5m 6s
-
(Locked)
Inspect objects with Get-Member10m 55s
-
(Locked)
Select object properties5m 51s
-
(Locked)
Sorting objects3m 45s
-
(Locked)
Filtering objects4m 33s
-
(Locked)
Creating custom objects8m 27s
-
(Locked)
Extending objects with methods10m 26s
-
(Locked)
Converting objects to different formats9m 17s
-
(Locked)
-
-
-
-
-
-
-
-