共用方式為


Administer the deployment using Windows PowerShell

 

Applies To: Dynamics CRM 2013

Windows PowerShell enables you to easily run deployment commands to change the configuration of your deployment, such as tasks that can be performed by using the Deployment Manager user interface. You can also use the methods that are described in the Microsoft Dynamics CRM SDK to perform these tasks. The Windows PowerShell cmdlets are installed on the computer when you install a Full Server role or when you install the Deployment Tools server role, if you’re installing individual server roles. To execute commands, you must first configure Microsoft Dynamics CRM 2013 with Windows PowerShell. This topic describes how to do this and explains each of the supported commands. You can find all the organization database settings available in Get and set deployment configuration settings. For sample scripts, refer to the See Also links later in this topic.

Find help about the Windows PowerShell cmdlets for Microsoft Dynamics CRM at Microsoft Dynamics CRM PowerShell Reference.

For more information about Windows PowerShell, see Scripting with Windows PowerShell.

This release of the cmdlets includes the following improvements:

  • Remote execution of PowerShell scripts

  • Improved error reporting from cmdlets

  • Improved output from cmdlets

For more information about the programmatic use of the Deployment Web Service see “Administer the deployment using the deployment web service” in the Microsoft Dynamics CRM 2013 SDK.

In This Topic

Configure the Microsoft Dynamics CRM PowerShell cmdlets

Use the PowerShell cmdlets

Set properties using PowerShell cmdlets

Supported PowerShell cmdlets

Configure the Microsoft Dynamics CRM PowerShell cmdlets

Register the cmdlets

  1. Log into the administrator account on your Microsoft Dynamics CRM server.

  2. Open a Windows PowerShell command prompt.

  3. In a Windows PowerShell window, enter the following command:

    Add-PSSnapin Microsoft.Crm.PowerShell
    

    This command adds the Microsoft Dynamics CRM Windows PowerShell snap-in to the current session. The snap-in is registered during installation and setup of the Microsoft Dynamics CRM server.

Get a list of the Microsoft Dynamics CRM cmdlets

  1. At the PowerShell prompt, type the following:

    Get-Help *Crm*
    

Get help for a cmdlet

  1. At the PowerShell prompt, type the following, replacing CrmCmdletName with the name of a command:

    Get-Help CrmCmdletName
    

For detailed help for a specific a cmdlet, use Get-Help CRMCmdlet –full, such as the Import-CRMOrganization cmdlet.

Get-Help Import-CRMOrganization -full

You must register the Microsoft Dynamics CRM Windows PowerShell commands, otherwise you will receive the following message when you try to run a cmdlet.

Warning

The term ‘Microsoft Dynamics CRM Windows PowerShell command' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Use the PowerShell cmdlets

Once you have registered the Microsoft Dynamics CRM Windows PowerShell commands, you can use them to perform tasks.

Use the following command to output the list of deployment administrators:

PS C:\Users\Administrator> Get-CrmDeploymentAdministrator

This command results in the following output:

Id

Name

ExtensionData

--

----

-------------

4f431656-90f8-e211-831c-00155da83c4f    

myDomainName\Administrator

Set properties using PowerShell cmdlets

Once you have registered the Microsoft Dynamics CRM Windows PowerShell commands, you can use them to perform tasks, such as set deployment-wide properties or set some organization properties. Examples are provided in the table below and in the following topics.

Supported PowerShell cmdlets

The following table lists the cmdlets available for use with Windows PowerShell.

Cmdlet

Description

Add-CrmServer

Adds a Microsoft Dynamics CRM server to the specified deployment.

Disable-CrmOrganization

Disables the specified Microsoft Dynamics CRM organization. For an example using this command, see Example: Disable or enable an organization.

Disable-CrmServer

Disables the specified Microsoft Dynamics CRM server.

Edit-CrmOrganization

Edits properties of the specified Microsoft Dynamics CRM organization. For an example using this command, see Example: Edit the attributes of an organization.

Enable-CrmOrganization

Enables the specified Microsoft Dynamics CRM organization. For an example using this command, see Example: Disable or enable an organization.

Enable-CrmServer

Enables the specified Microsoft Dynamics CRM server.

Get-CrmAccessLicense

Retrieves the server licensing and CAL licensing information for the deployment.

Get-AdvancedSetting

Gets an advanced setting value for Microsoft Dynamics CRM. In some cases, this cmdlet should only be used under the direction of Microsoft Support.

Get-CrmCertificate

Retrieves the certificate information for Microsoft Dynamics CRM. The certificate object contains the public key of the service bus signing certificate.

Get-CrmDeploymentAdministrator

Retrieves the deployment administrators for the Microsoft Dynamics CRM deployment.

Get-CrmLicenseProperty

Retrieves the license properties object for Microsoft Dynamics CRM.

Get-CrmOperationStatus

Retrieves the status on asynchronous operations sitting in the asynchronous operation queue for Microsoft Dynamics CRM.

Get-CrmOrganization

Retrieves one or all of the organizations in the deployment of Microsoft Dynamics CRM.

Get-CrmServer

Retrieves a server object for one or all Microsoft Dynamics CRM servers in a deployment.

Get-CrmSetting

Retrieves a Microsoft Dynamics CRM deployment setting object. For a list of the settings objects, see Get and set deployment configuration settings.

Import-CrmOrganization

Initiates the process to import a Microsoft Dynamics CRM organization database into the deployment.

New-CrmDeploymentAdministrator

Creates a new deployment administrator for the Microsoft Dynamics CRM deployment. For complete usage information, see Add a deployment administrator (PowerShell).

New-CrmOrganization

Initiates the process to create a new organization in the Microsoft Dynamics CRM deployment. For an example using this command, see Example: Create an organization. For complete usage information, see Create an organization (PowerShell).

Remove-CrmCertificate

Removes the specified certificate from Microsoft Dynamics CRM.

Remove-CrmDeploymentAdministrator

Removes the specified deployment administrator from the Microsoft Dynamics CRM deployment. For complete usage information, see Delete a deployment administrator.

Remove-CrmOrganization

Deletes the specified organization from the Microsoft Dynamics CRM deployment.

Remove-CrmServer

Deletes the specified server from the Microsoft Dynamics CRM deployment.

Set-CrmAdvancedSetting

Sets an advanced setting value for Microsoft Dynamics CRM. This is for internal use only, unless under the direction of Microsoft Support.

Set-CrmCertificate

Creates a certificate record or sets the properties of an existing certificate record in the Microsoft Dynamics CRM configuration database.

Set-CrmProductKey

Sets the product key for the Microsoft Dynamics CRM deployment.

Set-CrmSetting

Sets the specified Microsoft Dynamics CRM deployment wide settings. For a list of the settings objects, see Get and set deployment configuration settings.

Update-CrmOrganization

Updates the specified Microsoft Dynamics CRM organization with the latest software updates or upgrades the organization from Microsoft Dynamics CRM 2011 to Microsoft Dynamics CRM 2013.

See Also

Operating Guide for Microsoft Dynamics CRM 2013 (on-premises)
Examples of Windows PowerShell commands
Get and set deployment configuration settings
Add a deployment administrator (PowerShell)
Create an organization (PowerShell)
Configure web address settings (PowerShell)
Configure IFD settings (PowerShell)
Configure claims settings (PowerShell)
Delete a deployment administrator

© 2016 Microsoft Corporation. All rights reserved. Copyright