Sample: Add a Deployment Administrator (PowerShell)

Dynamics CRM 2011
[Applies to: Microsoft Dynamics CRM 2011]

This sample code is for Microsoft Dynamics CRM 2011, and can be found in the following location in the SDK download:

SampleCode\PS1\AddDeploymentAdministrator.ps1

Requirements

To set up the Microsoft Dynamics CRM PowerShell cmdlets, see Use PowerShell to Call the Deployment Web Service.

Demonstrates

The following script will add a deployment administrator. You must specify the following parameters:

Name - A string that contains the name of the user to add as deployment administrator. The name must be in the format domain\username.

Example

param
(
    #required params
    [string]$Name = $(throw "Name parameter not specified")
)

$RemoveSnapInWhenDone = $False

if (-not (Get-PSSnapin -Name Microsoft.Crm.PowerShell -ErrorAction SilentlyContinue))
{
    Add-PSSnapin Microsoft.Crm.PowerShell
    $RemoveSnapInWhenDone = $True
}

New-CrmDeploymentAdministrator -Name $Name

if($RemoveSnapInWhenDone)
{
    Remove-PSSnapin Microsoft.Crm.PowerShell
}

See Also

Microsoft Dynamics CRM 2011
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.

Community Additions

ADD
Show: