Share via


Get-SCClassInstance

Gets class instances.

Syntax

Empty (Default)

Get-SCClassInstance
    [-SCSession <Connection[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential>]
    [<CommonParameters>]

FromManagementPackClass

Get-SCClassInstance
    [-Class] <ManagementPackClass[]>
    [[-Filter] <String>]
    [-SCSession <Connection[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential>]
    [<CommonParameters>]

FromEMODisplayNameParameterSetName

Get-SCClassInstance
    [-DisplayName] <String[]>
    [-SCSession <Connection[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential>]
    [<CommonParameters>]

FromEMONameParameterSetName

Get-SCClassInstance
    [-Name] <String[]>
    [-SCSession <Connection[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential>]
    [<CommonParameters>]

FromGroup

Get-SCClassInstance
    [-Group] <EnterpriseManagementObject[]>
    [-SCSession <Connection[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential>]
    [<CommonParameters>]

FromEMOIdParameterSetName

Get-SCClassInstance
    [-Id] <Guid[]>
    [-SCSession <Connection[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential>]
    [<CommonParameters>]

FromCriteria

Get-SCClassInstance
    [-Criteria] <EnterpriseManagementObjectCriteria>
    [-SCSession <Connection[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential>]
    [<CommonParameters>]

Description

The Get-SCClassInstance cmdlet retrieves class instances.

Examples

Example 1: Get computers by NetBIOS name

PS C:\>$MP = Get-SCManagementPack -name "Microsoft.Windows.Library"
PS C:\>$CriteriaFormat = '<Criteria
>> xmlns="http://Microsoft.EnterpriseManagement.Core.Criteria/"><Reference
>> Id="Microsoft.Windows.Library" Version="{0}" PublicKeyToken="{1}"
>> Alias="myMP"
>>/><Expression><SimpleExpression><ValueExpressionLeft><Property>$Target/Property[Type="myMP!Microsoft.Windows.Computer"]/NetbiosDomainName$</Property></ValueExpressionLeft><Operator>Equal</Operator><ValueExpressionRight><Value>IR2</Value></ValueExpressionRight></SimpleExpression></Expression></Criteria>'
PS C:\>$CriteriaType = "Microsoft.EnterpriseManagement.Common.EnterpriseManagementObjectCriteria"
PS C:\>$criteriaString = $criteriaFormat -f $MP.Version, $MP.KeyToken
PS C:\>$class = Get-SCClass -name "microsoft.windows.computer"
PS C:\>$criteria = new-object $CriteriaType $CriteriaString,$class,$class.ManagementGroup
PS C:\>Get-SCClassInstance -criteria $criteria

These commands retrieve computers using the criteria of NetbiosDomainName equals WOODGROVE. The first commands define the parameters that are then used in the final Get-SCClassInstance cmdlet.

Example 2: Get class instances using a filter

PS C:\>Get-SCClassInstance -class $class -filter 'NetbiosDomainName -eq "WOODGROVE"'
PrincipalName                 ObjectStatus ActiveDirectorySite     NetBiosDomainName
-------------                 ------------ -------------------     -----------------
WIN-752HJBSX24M.woodgrove.com Active       Default-First-Site-Name WOODGROVE
JWT-SCDW.woodgrove.com        Active                               WOODGROVE

This command retrieves class instance objects from the Service Manager database using a filter. Note that the property name in the filter must be the exact name of the property and that it is case sensitive.

Example 3: Get all computer objects

PS C:\>$class = Get-SCClass -name microsoft.windows.computer
PS C:\>Get-SCClassInstance -class $class|format-table PrincipalName,ObjectStatus,ActiveDirectorySite,NetbiosDomainName
PrincipalName                 ObjectStatus ActiveDirectorySite     NetbiosDomainName
-------------                 ------------ -------------------     -----------------
WIN-752HJBSX24M.woodgrove.com Active       Default-First-Site-Name WOODGROVE
JWT-SCDW.woodgrove.com        Active                               WOODGROVE

This commands retrieve all class instance objects of type Computer from the Service Manager database.

Parameters

-Class

Specifies the name of one or more classes to retrieve. You can specify a ManagementPackClass object that is returned by the Get-SCClass cmdlet.

Parameter properties

Type:

Microsoft.EnterpriseManagement.Configuration.ManagementPackClass[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromManagementPackClass
Position:1
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-ComputerName

Specifies a computer to establish a connection with. The computer must be running the System Center Data Access service. The default value is the computer for the current management group connection.

Valid formats include a NetBIOS name, an IP address, or a fully qualified domain name (FQDN). To specify the local computer, type the computer name, "localhost", or a dot (.).

Parameter properties

Type:

System.String[]

Default value:Localhost
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Credential

Specifies a user account under which the management group connection will run. The account must have access to the server that is specified in the ComputerName parameter, if the server is specified. The default value is the current user.

You can enter a PSCredential object that is returned by the Get-Credential cmdlet.

Parameter properties

Type:System.Management.Automation.PSCredential
Default value:Current user context
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Criteria

Specifies a criteria object that restricts the set of class instances that are returned from the management server.

Parameter properties

Type:Microsoft.EnterpriseManagement.Common.EnterpriseManagementObjectCriteria
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromCriteria
Position:1
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-DisplayName

Specifies the display name of the class instance to retrieve.

Parameter properties

Type:

System.String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromEMODisplayNameParameterSetName
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Filter

Filters the results set. The syntax of the filter is the <property> operator <value>, where valid operators are -eq, -ne, -gt, -ge, -lt, -le, -like, and -notlike. Using a filter is efficient because the filter limits the results that are retrieved from the management server, rather than being applied after the results are returned to PowerShell.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromManagementPackClass
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Group

Specifies an instance of a group that contains the class instances to retrieve.

Parameter properties

Type:

Microsoft.EnterpriseManagement.Common.EnterpriseManagementObject[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromGroup
Position:1
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Id

Specifies the ID of the class instances to retrieve. This may be a GUID or a string that will be converted to a GUID.

Parameter properties

Type:

System.Guid[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromEMOIdParameterSetName
Position:1
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Specifies the name of the class instances to retrieve.

Parameter properties

Type:

System.String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromEMONameParameterSetName
Position:1
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-SCSession

Specifies a connection to a management server. The default value is the current management group connection.

You can enter a management group connection object that is returned by the Get-SCManagementGroupConnection cmdlet.

Parameter properties

Type:

Microsoft.SystemCenter.Core.Connection.Connection[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

Microsoft.EnterpriseManagement.Configuration.ManagementPackClass

You can pipe a class to the Class parameter of the Get-SCClassInstance cmdlet.

Outputs

EnterpriseManagementObject

This cmdlet generates an EnterpriseManagementObject#<classtype> object.