Rename Domain in Windows Server 2008


Hi,

I was assigned the task of renaming the domain. This post was extremely useful.

http://www.shariqsheikh.com/blog/index.php/200804/how-to-rename-a-windows-server-2008-domain/

I’ll put few of the steps from that post here 

“From the command prompt, I started out by running rendom /list which outputs an XML file (Domainlist.xml) to the directory where rendom resides. You edit that file to change your domain configuration to the new domain name. i.e ForestDNSZones, DomainDNSZones, Netbios name. See referenced link for details.

After you have modified the file you can run rendom /showforest which shows you the future configuration, verify and make changes if necessary.

Upload the changes you have made in the XML file: Run rendom /upload

Verify readiness of Domain Controller(s): Run rendom /prepare

Execute domain rename instructions: Run rendom /execute

After thats finishes up successfully, you should also run GPFIXUP tool to fix up GPO references to your old domain name.

Here is an example :

C:\Users\Administrator>gpfixup /olddns:08r2.lab /newdns:mcts.lab
Group Policy fix up utility Version 1.1 (Microsoft)

Start fixing group policy (GroupPolicyContainer) objects:
……..

Start fixing site group policy links:
.

Start fixing non-site group policy links:
….
gpfixup tool executed with success.

C:\Users\Administrator>gpfixup /oldnb:08r2 /newnb:mcts
Group Policy fix up utility Version 1.1 (Microsoft)

Start fixing group policy (GroupPolicyContainer) objects:
..
gpfixup tool executed with success.

Lastly, run rendom /clean”

Bye..

Sample function using SetStateRequest to deactivate record



// Get all the active records for a custom entity and deacitvate it

// In this case Custom Entity name is new_customentity and it has many to one relationship with contact record

 // So we are finding all the active custom entity records for a particular contact

 

// and deactivating it

 

private
void DeActivateCustomRecords(string contactID, IOrganizationService _service)
{
// setting contact id

ConditionExpression condition1 = new ConditionExpression();

condition1.AttributeName=“new_contactid”;

condition1.Operator =ConditionOperator.Equal;

condition1.Values.Add(contactID);


// and state code =0 -> active record

ConditionExpression condition2 = new ConditionExpression();

condition2.AttributeName =“statecode”;

condition2.Operator =ConditionOperator.Equal;

condition2.Values.Add(0);

 // And the condition

FilterExpression filterExpression = new FilterExpression();

filterExpression.AddCondition(condition1);

filterExpression.AddCondition(condition2);

filterExpression.FilterOperator =LogicalOperator.And;

 //Create a column set to get the custom entity records id
//we need them to disable the records

ColumnSet columns = new ColumnSet(“new_customentityid”);
// Create query expression.

QueryExpression query1 = new QueryExpression();

query1.ColumnSet = columns;

query1.EntityName =“new_customentity”;

query1.Criteria = filterExpression;

 try{

EntityCollection result= _service.RetrieveMultiple(query1);
foreach (Entity customEntityResult in result.Entities)
{

SetStateRequest setState = new SetStateRequest();

setState.EntityMoniker = new EntityReference();

setState.EntityMoniker.Id = customEntityResult.Id;

setState.EntityMoniker.Name = “new_customentity”;

setState.EntityMoniker.LogicalName = entityElgResult.LogicalName;

setState.State =new OptionSetValue();

setState.State.Value = 1;

setState.Status = new OptionSetValue();

setState.Status.Value = -1;

SetStateResponse setStateResponse = (SetStateResponse)_service.Execute(setState);

}

}
catch (Exception ex)
{
throw ex;

}

}

Hope it is useful !

Cannot read configuration file due to insufficient permissions


 

Was getting this issue in one of my ASP.NET application in IIS 7.

Gave Read Permission to IIS_IUSRS on the site.

This fixed the problem.

Good resource on Special Characters


Just found a good site,

http://www.the-art-of-web.com/javascript/escape/

I had this url in CRM 2011 for creating related entity record

 http://servername:port/orgname/main.aspx?etn=contact&extraqs=_CreateFromId%3d%257b554272F4-A8E1-DF11-AF7A-00155D045700%257d%26_CreateFromType%3d10001%26etc%3d2&pagetype=entityrecordBye.

quickly wanted to escape the special character, used the tool given at that site to get the url without any special character

 http://servername:port/orgname/main.aspx?etn=contact&extraqs=_CreateFromId={554272F4-A8E1-DF11-AF7A-00155D045700}&_CreateFromType=10001&etc=2&pagetype=entityrecord

Sample code to add a custom group to lead form in CRM 2011


For adding a custom group to a lead form we can make use of the following sample code.

Just replace the lead with your entity’s schema name to use it

<RibbonDiffXml>

<CustomActions>

<CustomAction
Id=“Sample.lead.form.CustomGroup.MaxSize.CustomAction“
Location=“Mscrm.Form.lead.MainTab.Scaling._children“
Sequence=“120“>

<CommandUIDefinition>

<MaxSize
Id=“Sample.lead.form.CustomGroup.MaxSize“
GroupId=“MyLeadCustomGroup“
Sequence=“21“
Size=“LargeLarge“/>

</CommandUIDefinition>

</CustomAction>

<CustomAction
Id=“MyLeadCustomAction“
Location=“Mscrm.Form.lead.MainTab.Groups._children“
Sequence=“110“>

<CommandUIDefinition>

<Group
Id=“MyLeadCustomGroup“
Title=“My Lead Custom Group“
Sequence=“39“
Template=“Mscrm.Templates.Flexible2“>

<Controls
Id=“MyCustomControls“>

<Button
Id=“MyCustomButton1“
Sequence=“10“
LabelText=“My Custom Button1“
ToolTipTitle=“My Custom Button1“
ToolTipDescription=“My Custom Button1“
TemplateAlias=“o1“/>

</Controls>

</Group>

</CommandUIDefinition>

</CustomAction>

</CustomActions>

<Templates>

<RibbonTemplates
Id=“Mscrm.Templates“/>

</Templates>

<CommandDefinitions>

</CommandDefinitions>

<RuleDefinitions>

<TabDisplayRules/>

<DisplayRules/>

<EnableRules/>

</RuleDefinitions>

<LocLabels/>

</RibbonDiffXml>

 

Hope it helps!

 

 

Showing Custom Button on Update in CRM 2011


Now let us built on our existing example of adding custom button and adding JavaScript to it.

https://nishantrana.wordpress.com/2010/11/04/adding-my-first-custom-button-in-crm-2011/

https://nishantrana.wordpress.com/2010/11/04/using-javascript-in-a-custom-button-in-crm-2011/

Get the solution file here

http://www.box.net/shared/m9q9otkqfg

Now we want our button to appear only in case of Update form, while creating a new record it shouldn’t appear.

For this we need to first define a DisplayRule in RuleDefinitions.

<RuleDefinitions>

<TabDisplayRules/>

<DisplayRules>


<DisplayRule
Id=“MyRule“>

<FormStateRule
State=“Create“
InvertResult=“true“ />

</DisplayRule>

</DisplayRules>

<EnableRules/>

</RuleDefinitions>

This rule we will refer in our CommandDefinition for our button.

<CommandDefinitions>

<CommandDefinition
Id=“Cmd_JavaScript“>

<EnableRules>

<EnableRule
Id=“Mscrm.Enabled“/>

</EnableRules>


<DisplayRules>

<DisplayRule
Id=“MyRule“></DisplayRule>

</DisplayRules>

<Actions>

<JavaScriptFunction
Library=“$webresource:new_MyJavaScript“
FunctionName=“HelloWorld“>

</JavaScriptFunction>

</Actions>

</CommandDefinition>

</CommandDefinitions>

Now after importing and publishing it

The final RibbonDiffXml looks like this

<RibbonDiffXml>

<CustomActions>

<CustomAction
Id=“CA_MyFirstButton“
Location=“Mscrm.Form.account.MainTab.Save.Controls._children“
Sequence=“31“>

<CommandUIDefinition>

<Button
Id=“B_MyFirstButton“
Command=“Cmd_JavaScript“
LabelText=“My First Button“
ToolTipTitle=“My First Button Tool Tip Title“
ToolTipDescription=“My First Button Tool Tip Description“
TemplateAlias=“o1“
Image16by16=“/_imgs/ribbon/saveandclose16.png“
Image32by32=“/_imgs/ribbon/saveandclose32.png“/>

</CommandUIDefinition>

</CustomAction>

</CustomActions>

<Templates>

<RibbonTemplates
Id=“Mscrm.Templates“/>

</Templates>

<CommandDefinitions>

<CommandDefinition
Id=“Cmd_JavaScript“>

<EnableRules>

<EnableRule
Id=“Mscrm.Enabled“/>

</EnableRules>

<DisplayRules>

<DisplayRule
Id=“MyRule“>

</DisplayRule>

</DisplayRules>

<Actions>

<JavaScriptFunction
Library=“$webresource:new_MyJavaScript“
FunctionName=“HelloWorld“>

</JavaScriptFunction>

</Actions>

</CommandDefinition>

</CommandDefinitions>

<RuleDefinitions>

<TabDisplayRules/>

<DisplayRules>

<DisplayRule
Id=“MyRule“>

<FormStateRule
State=“Create”


InvertResult=“true“ />

</DisplayRule>

</DisplayRules>

<EnableRules/>

</RuleDefinitions>

<LocLabels/>

</RibbonDiffXml>

Hope it helps !

Nishant Rana's Weblog

Everything related to Microsoft .NET Technology

Skip to content ↓