Import-SCSMInstance
Imports objects and relationships from a comma-separated value (.csv) file into Service Manager.
Syntax
Default (Default)
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. If specified, the value of this parameter must be an integer between 1 and 5000. The default value is 50.
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.
Parameter properties
Type: | System.Int32 |
Default value: | 50 |
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 |
-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.
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 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.
Parameter properties
Type: | System.Management.Automation.PSCredential |
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 |
-DataFileName
Specifies the file path of the .csv file that contains the instance data.
Parameter properties
Type: | System.String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-FormatFileName
Specifies the file path of an .xml file in which the format of the .csv file is defined.
Parameter properties
Type: | System.String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-SCSession
Specifies an object that represents the session to a Service Manager management server.
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
None.
You cannot pipe input to this cmdlet.
Outputs
None.
This cmdlet does not generate any output.