Instantly share code, notes, and snippets.

What would you like to do?
Simple way to add class to Powershell
Class Fruit {
#Set the variable
#Create the constructor
Fruit ($FruitName) {
$this.FruitName = $FruitName
#Initialize the class
#Get the fruit data, might be a sql data
$Fruits = "Banana", "Apple", "Orange"
#Write the fruit data to the class
$Fruits | % { $NewFruit.FruitName = $_ }
#Writing the fruits to console or do something
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment