Import-SCSMInstance

Imports objects and relationships from a .csv file into Service Manager.

Syntax

Import-SCSMInstance
      -FormatFileName <String>
      -DataFileName <String>
      [-BatchSize <Int32>]
      [-SCSession <Connection[]>]
      [-ComputerName <String[]>]
      [-Credential <PSCredential>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Import-SCSMInstance cmdlet imports objects and relationships from a comma-separated value (.csv) file into Service Manager.

Two parameters must be set to import instances in bulk into Service Manager:

  • DataFileName, which must contain the file path of a .csv file that contains the instance data.
  • FormatFileName, which must contain the file path of an .xml file that defines the format of the .csv file.

The optional BatchSize parameter specifies the number of objects or projection instances that will be committed on each database write.

Examples

Example 1: Import computer projections

PS C:\>Import-SCSMInstance -FormatFileName "computers.xml" -DataFileName "computers.csv" -BatchSize 100
Contents of computers.xml
-------------------------
<CSVImportFormat>
  <Projection Type="Microsoft.Windows.Computer.ProjectionType">
    <Seed>
      <Class Type="Microsoft.Windows.Server.Computer">
        <Property ID="IsVirtualNode"/>
        <Property ID="PrincipalName"/>
      </Class>
    </Seed>
    <Component Alias="OperatingSystem">
      <Seed>
        <Class Type="Microsoft.Windows.OperatingSystem">
          <Property ID="OSVersion"/>
          <Property ID="ProductType"/>
          <Property ID="BuildNumber"/>
        </Class>
      </Seed>
    </Component>
  </Projection>
</CSVImportFormat>
Contents of computers.csv
-------------------------
false, computer1, 6.1, Windows, 1003
false, computer2, 6.1, Windows, 1003

This command imports computer projections from the file that is named computers.csv. The command imports 100 rows at a time.

Parameters

-BatchSize

Specifies the number of objects or projection instances that this cmdlet commits on each database write. This value must be an integer between 1 and 5000. The default value is 50.

Type:Int32
Position:Named
Default value:50
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ComputerName

Specifies the name of the computer on which the System Center Data Access service runs. The user account that is specified in the Credential parameter must have access rights to the specified computer.

Type:String[]
Position:Named
Default value:Localhost
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Credential

Specifies the credentials that this cmdlet uses to connect to the server on which the System Center Data Access service runs. The specified user account must have access rights to that server.

Type:PSCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DataFileName

Specifies the file path of the .csv file that contains the instance data.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-FormatFileName

Specifies the file path of an .xml file in which the format of the .csv file is defined.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-SCSession

Specifies an object that represents the session to a Service Manager management server.

Type:Connection[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None.

You cannot pipe input to this cmdlet.

Outputs

None.

This cmdlet does not generate any output.