Share via


New-SCClassInstance

Adds a class instance to the database.

Syntax

Default (Default)

New-SCClassInstance
    [-Class] <ManagementPackClass>
    [-PassThru]
    [-Property] <Hashtable>
    [-SCSession <Connection[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The New-SCClassInstance cmdlet adds a class instance to the database.

Examples

Example 1: Create printer class instances

PS C:\>0..9 | ForEach-Object {
  New-SCClassInstance (Get-SCClass -Name "Microsoft.Ad.Printer") @{
    UNCName = \\ContosoPrintServer\Printer$_
    ServerName = "ContosoPrintServer"
    PrinterName = "Printer$_"
    Location = "Contoso Headquarters"
    Notes = "Added by PowerShell script."
  }
}

These commands create a set of 10 printer class instances named Printer0 through Printer9. The location is set to "Contoso Headquarters", and they are all associated with the ServerName "ContosoPrintServer".

Parameters

-Class

Specifies the class on which the new instance is based. You can use the Get-SCClass cmdlet to obtain the ManagementPackClass object that is required for this parameter.

Parameter properties

Type:Microsoft.EnterpriseManagement.Configuration.ManagementPackClass
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

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

-ComputerName

Specifies a computer with which to establish a connection. 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

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:System.Management.Automation.SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

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

-PassThru

Specifies the output object that represents the new class instance object. This output object can be passed to other cmdlets.

Parameter properties

Type:System.Management.Automation.SwitchParameter
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

-Property

A hashtable of property-value pairs representing the property values of the new instance. Each key of the hashtable must be the name of a valid property within the class that is specified in the Class parameter and each value must be a valid object that can be stored in the property of its corresponding key.

Parameter properties

Type:System.Collections.Hashtable
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:2
Mandatory:True
Value from pipeline:False
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

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:System.Management.Automation.SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

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 New-SCClassInstance cmdlet, for example, the object that is returned by the Get-SCClass cmdlet.

Outputs

None

This cmdlet does not generate any output.