There's a possibility to create and use .NetFramework class in PowerShell via cmdlet "Add-Type". You should use New-Object cmdlet to instantiate objects.

The code below is an example to initialize Class "CarCL" and to create 2 objects of this class - $box and $car.

if (-not ([System.Management.Automation.PSTypeName]'CarCL').Type) 
{ 
Add-Type @' 
        public class CarCL 
        { 
                public string Width; 
                public string Height; 
        } 
'@ 
} 
$obj = New-Object CarCL 
$obj.Height = 50 
$obj.Width = 100 

$box = New-Object CarCL 
$box.Height = 200 
$box.Width = 200 

Write-Host $obj.Height $obj.Width 
Write-Host $box.Height $box.Width

 

If you don't use construction like ' if (-not ([System.Management.Automation.PSTypeName]'CarCL').Type)', you can get the warning on the non-first execution of PowerShell Script.

Add-Type : Cannot add type. The type name 'CarCL' already exists.