PowerShell SMLets - Cannot Create an instance of an abstract class

534 views Asked by At

I am using SMLets (A collection of cmdlets that work with System Center) for PowerShell to create an object of a class. I know I am not supposed to create objects of abstract classes, but I am not sure what other class I could possible select. I am trying to create a group in System Center Service Manager, and the class for a configuration item group as far as I can tell is the one I am entering...

My code is:

#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

Once I got this code working my idea was to read from a csv file containing a list of all the groups and loop the creation process. However, I keep getting the error: "Cannot create objects of an abstract class"

Am I using the incorrect class to create a group? If so, what is the correct class to select? Is there a more efficient method to do this? Any ideas at all please share, thank you in advance :)

0

There are 0 answers