Use PowerShell to Call the Deployment Web Service
Windows PowerShell enables you to easily run deployment commands without writing code using the Deployment Web service. To execute commands, you must first configure Microsoft Dynamics CRM 2011 with Windows PowerShell. This topic describes how to do this and explains each of the supported commands.
In This Topic
Configure the Microsoft Dynamics CRM PowerShell cmdlets
Register the cmdlets
-
Log into the administrator account on your Microsoft Dynamics CRM server.
-
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.
Supported PowerShell cmdlets
The following table lists the cmdlets available for use with Windows PowerShell.
|
Cmdlet |
Description |
|
Disable-CrmServer |
Disables the specified Microsoft Dynamics CRM server. |
|
Disable-CrmOrganization |
Disables the specified Microsoft Dynamics CRM organization. |
|
Edit-CrmOrganization |
Edits properties of the specified Microsoft Dynamics CRM organization. |
|
Enable-CrmServer |
Enables the specified Microsoft Dynamics CRM server. |
|
Enable-CrmOrganization |
Enables the specified Microsoft Dynamics CRM organization. |
|
Get-CrmOrganization |
Retrieves one or all of the organizations in the deployment of Microsoft Dynamics CRM. |
|
Get-CrmOperationStatus |
Retrieves the status on asynchronous operations sitting in the deferred operation queue for Microsoft Dynamics CRM. |
|
Get-CrmSetting |
Retrieves a Microsoft Dynamics CRM deployment setting object. For a list of the settings objects, see Deployment Entities and Deployment Configuration Settings. |
|
Get-CrmServer |
Retrieves a server object for one or all Microsoft Dynamics CRM servers in a deployment. |
|
Get-CrmLicenseProperty |
Retrieves the license properties object for Microsoft Dynamics CRM. |
|
Get-CrmAdvancedSetting |
Gets an advanced setting value for Microsoft Dynamics CRM. The metadata specify that the setting is readable in order to retrieve the specified value. |
|
Get-CrmAccessLicense |
Retrieves the server licensing and CAL licensing information for the deployment of Microsoft Dynamics CRM. |
|
Get-CrmDeploymentAdministrator |
Retrieves the deployment administrators for the Microsoft Dynamics CRM deployment. |
|
Get-CrmCertificate |
Retrieves the certificate information for Microsoft Dynamics CRM. The certificate object contains the public key of the service bus signing certificate. |
|
Import-CrmOrganization |
Initiates the process to import a Microsoft Dynamics CRM organization database into the deployment. |
|
New-CrmOrganization |
Initiates the process to create a new organization in the Microsoft Dynamics CRM deployment. |
|
New-CrmDeploymentAdministrator |
Creates a new deployment administrator for the Microsoft Dynamics CRM deployment. |
|
Remove-CrmOrganization |
Deletes the specified organization from the Microsoft Dynamics CRM deployment. |
|
Remove-CrmServer |
Deletes the specified server from the Microsoft Dynamics CRM deployment. |
|
Remove-CrmCertificate |
Removes the specified certificate from Microsoft Dynamics CRM. |
|
Remove-CrmDeploymentAdministrator |
Removes the specified deployment administrator from the Microsoft Dynamics CRM deployment. |
|
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 Deployment Entities and Deployment Configuration Settings. |
|
Set-CrmAdvancedSetting |
Sets an advanced setting value for Microsoft Dynamics CRM. The metadata specify that the setting is writable in order to set the specified value. |
|
Set-CrmCertificate |
Creates a certificate record or sets the properties of an existing certificate record in the Microsoft Dynamics CRM configuration database. |
|
Update-CrmOrganization |
Updates the specified Microsoft Dynamics CRM organization with the latest software updates or upgrades the organization from Microsoft Dynamics CRM 4.0 to Microsoft Dynamics CRM 2011. |
Example
The following example shows how to use Windows PowerShell to enable tracing. This pattern can be used for all settings. For a list of the settings objects, see Deployment Entities and Deployment Configuration Settings.
PS C:\Users\Administrator> Add-PSSnapin Microsoft.Crm.PowerShell
PS C:\Users\Administrator> Get-CrmSetting TraceSettings
CallStack : True
Categories : *:Error
Directory : c:\crmdrop\logs
Enabled : False
FileSize : 10
ExtensionData : System.Runtime.Serialization.ExtensionDataObject
PS C:\Users\Administrator> $setting = Get-CrmSetting TraceSettings
PS C:\Users\Administrator> $setting.Enabled="True"
PS C:\Users\Administrator> Set-CrmSetting $setting
PS C:\Users\Administrator> Get-CrmSetting TraceSettings
CallStack : True
Categories : *:Error
Directory : c:\crmdrop\logs
Enabled : True
FileSize : 10
ExtensionData : System.Runtime.Serialization.ExtensionDataObject
See Also
Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online
Send comments about this topic to Microsoft.
© 2011 Microsoft Corporation. All rights reserved.
