Skip to content

Instantly share code, notes, and snippets.

@Akaitatsu
Akaitatsu / PowerShell5ClassExample.ps1
Last active January 19, 2018 14:46
Example of creating and using classes with constructors in PowerShell 5+ to reduce repetitive PSCustomObject code
# Reference: https://blogs.technet.microsoft.com/heyscriptingguy/2015/09/09/powershell-5-classes-constructor-overloading/
Class Dog {
[string] $Name;
[string] $Sex;
[string] $Color;
[string] $Breed;
[int] $BarkVolume;
Dog (
[string] $name,
[string] $sex,