Compartilhar via


Import-CrmPackage

Applies To: CRM 2016 on-prem, Dynamics 365 (online), Dynamics 365 (on-premises)

Import-CrmPackage

Imports a package to a Microsoft Dynamics 365 instance.

Syntax

Parameter Set: Default
Import-CrmPackage [-CrmConnection] <String> [-PackageName] <String> [[-PackageDirectory] <String> ] [[-UnpackFilesDirectory] <String> ] [-AllowCustomCode <String> ] [-LogWriteDirectory <String> ] [-RuntimePackageSettings <String> ] [-Timeout <String> ] 

Detailed Description

The Import-CrmPackage cmdlet imports a package to a Dynamics 365 instance. A package can contain Dynamics 365 solution files, files or exported data files from the Configuration Migration tool, custom code that can run during or after the package is deployed to the Dynamics 365 instance, and HTML content specific to the package that can display at the beginning and end of the package deployment process. The HTML content can be useful to provide a description of the solutions and files that are deployed in the package.

This cmdlet applies to Microsoft Dynamics 365 (online) and Microsoft Dynamics 365 (on-premises).

Parameters

-CrmConnection<String>

Connection object to Microsoft Dynamics 365 instance. This is an initialized instance of the Microsoft.Xrm.Tooling.Connector class.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-PackageName<String>

Name of the assembly (.dll) that contains the package definition.

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-PackageDirectory<String>

Directory where a package or packages can be found.

Aliases

none

Required?

false

Position?

3

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-UnpackFilesDirectory<String>

Directory where the files are extracted to. If your package doesn't have files that need to be unpacked or extracted, you don't have to specify this parameter.

Aliases

none

Required?

false

Position?

4

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-LogWriteDirectory<String>

Custom directory location to store the Package Deployer log files. The directory must already exist, and the user who is running the cmdlet must have Write permission to the directory. You must also use the -Verbose parameter along with the -LogWriteDirectory parameter to be able to store the log files in a custom location

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RuntimePackageSettings<String>

Used to pass data at runtime to the package that is being deployed in a key=value format delimited by pipe (|): key1=value1|key2=value2|key3=value3. For example: LCID=1033|SkipChecks=true

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Timeout<String>

The timespan notation for the timeout value of a package deployment operation. The format applied is "[d:]h:mm:ss", where d is optional For example: 1:30:00 means wait up to 1 hr and 30 mins for the package deployment operation to complete. 1:14:30:00 means wait up to 1 day, 14 hrs, and 30 mins for the package deployment operation to complete.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-AllowCustomCode<String>

For Internal use only.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

-------------------------- EXAMPLE 1 --------------------------

This example imports a package defined by SampleCRMPackage.dll, which is available in the c:\CRM\SDK\Tools\PackageDeployer directory.

The -Verbose parameter at the end of the command is optional, and is used to display a detailed log of the activities performed during the package deployment process.

PS C:\>Import-CrmPackage -CrmConnection $CRMConn -PackageDirectory c:\CRM\SDK\Tools\PackageDeployer -PackageName SampleCRMPackage.dll -UnpackFilesDirectory c:\UnpackedFiles -Verbose

-------------------------- EXAMPLE 2 --------------------------

This example specifies a custom directory, c:\MyLogFiles, to store the log files and imports a package defined by SampleCRMPackage.dll, which is available in the c:\CRM\SDK\Tools\PackageDeployer directory. The Verbose parameter at the end of the command is mandatory in order to write to a log file at a custom location.

PS C:\> Import-CrmPackage -CrmConnection $CRMConn -PackageDirectory c:\CRM\SDK\Tools\PackageDeployer -PackageName SampleCRMPackage.dll -LogWriteDirectory c:\MyLogFiles -Verbose

Get-CrmPackages

Use Windows PowerShell to deploy packages