Class PowerShell Smlet-无法创建抽象类的实例

Class PowerShell Smlet-无法创建抽象类的实例,class,object,powershell,cmdlets,system-center,Class,Object,Powershell,Cmdlets,System Center,我正在使用PowerShell的smlet(与System Center一起工作的cmdlet集合)来创建类的对象。我知道我不应该创建抽象类的对象,但我不确定我还可以选择什么样的类。我正在尝试在System Center Service Manager中创建一个组,据我所知,配置项组的类就是我正在输入的类 我的代码是: #Get the name of the class I want to create an object of and store it in a variable $grou

我正在使用
PowerShell的
smlet
(与System Center一起工作的cmdlet集合)来创建类的对象。我知道我不应该创建抽象类的对象,但我不确定我还可以选择什么样的类。我正在尝试在System Center Service Manager中创建一个组,据我所知,配置项组的类就是我正在输入的类

我的代码是:

#Get the name of the class I want to create an object of and store it in a variable
$groupClass = Get-SCSMClass -Name "Microsoft.SystemCenter.ConfigItemGroup$"
#Return the variable stored to ensure this part is working (Debug purposes)
$groupClass

#Get the active status of an object and store it in a variable
$objStatus = Get-SCSMEnumeration -Name System.ConfigItem.ObjectStatusEnum.Active

#Return the variable stored to ensure this part is working (Debug purposes)
$objStatus
#Create the object stored in my class variable and modify the DisplayName and ObjectStatus properties.
New-SCSMObject -Class $groupClass -PropertyHashtable (@{DisplayName = "Test"; ObjectStatus = $objStatus;}) -Debug -Verbose
一旦这个代码开始工作,我的想法就是从一个包含所有组列表的csv文件中读取,并循环创建过程。但是,我不断得到错误:“无法创建抽象类的对象”


我是否使用了错误的类来创建组?如果是这样,那么要选择的正确类是什么?有没有更有效的方法?任何想法请分享,提前谢谢:)

我知道我无法创建抽象类的对象,所以我猜我为组选择的类肯定不正确。但这对我来说没有意义,因为如果我在控制台中手动创建一个组,然后在数据库中查看对象(定义该组),它会将我试图使用的类命名为基类。所以它必须继承这个类的属性并扩展以为每个组创建自己的子类?如果是这样,我如何通过脚本自动创建这个类?另一个问题是定义每个组的动态成员。。。据我所知,这是存储在XML管理包中的,这可能会使事情变得更加困难。是否也可以自动创建动态成员的规则(发现规则)?您可能需要使用一些内联c#代码来创建从抽象类派生的具体类,例如使用Add Type。