New MPToolClass - AndreasSobczyk/MPTool GitHub Wiki
#New-MPToolClass Creates a new class . Adds the needed references for the base class automatically. Returns object of type [Microsoft.EnterpriseManagement.Configuration.ManagementPackClass]
###Parameters
- ManagementServerFQDN [string] – FQDN of the management server to connect.
- ManagementPackName [string] – Name of the management pack.
- ClassName [string] – Name of the new class.
- ClassDisplayName [string] – (Optional) Display name of the new class.
- ClassDescription [string] – (Optional) Description of the new class.
- BaseClassName [string] – (Optional) Name of the base class.
- BaseClassMPName [string] – (Optional) Management pack name of the base class.
- BaseClassMPAlias [string] – (Optional) Management Pack alias fo the base class.
- ClassKeyProperties [array] – (Optional) Array of key properties for the new class. Usually only one key property.
Example - @("KeyProp") - ClassNonKeyProperties [array] – (Optional) Array of non-key properties for the new class.
Example - @("Prop1","Prop2") - IsAbstract [boolean] – (Optional) Abstract setting for the class $true / $false. Default is $false
- IsHosted [boolean] – (Optional) Hosted setting for the class $true / $false. Default is $true
- IsSingleton [boolean] – (Optional) Singleton setting for the class $true / $false. Default is $false
###Example Creates a class named "Contoso.CustomClasss", with one key property "URL" and two non-key properties "Prop1" and "Prop2", in the management pack "Contoso.Monitoring"
New-MPToolClass -ManagementServerFQDN scom01.contoso.com `
-ManagementPackName "Contoso.Monitoring" `
-ClassName "Contoso.LocalApp" `
-ClassDisplayName "Contoso LocalApp" `
-ClassDescription "Class to Contoso.LocalApp" `
-BaseClassName "Contoso.Instance.Base" `
-ClassKeyProperties @("Url") `
-ClassNonKeyProperties @("Prop1","Prop2") `
-IsAbstract $true -IsHosted $true -IsSingleton $false