How to Write a Class in PowerShell

 

To make it simple we will Create a Class

Instantiate an Object of  our class and fill data into to the object.

Write the code in powershell ise and run it.

 

$QuickTest = New-Object Card

Class Card
{

[String]$Firstname
[String]$Lastname
[String]$Adress
[int]$Phone

}

 

to check our class object write $QuickTest

Lets fill some data in.

write $QuickTest to see the changes

You now know howto create a class  Instantiate an object of our class and fill it with data.