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..

Searching for an email id in Active Directory using C#

These are the steps i followed
1) Created a new windows application.
2) Added reference to System.DirectoryServices dll
3) Added a textbox(where the email id will be entered) and a button in the form.
4) On btnClick this is the code i wrote

we use the DirectorySearcher class to query the directory and read the attributes of the objects found
DirectorySearcher Dsearch = new DirectorySearcher();
EmailID = txtEmailID.Text;

The filter in an LDAP query restricts the objects that the search will return. It is the equivalent of the WHERE clause


Dsearch.Filter = “(&(objectCategory=person)(sAMAccountName=*)(mail=”+EmailID+”))”;
objectCategory=This attribute is meant to be used to group common types of objects together so that we can search across all of them. Both user and contact classes share the same objectCategory value of person.
sAMAccountName =To separate users from contacts efficiently we can make user of sAMAccountName attribute
mail =Finally the mail attribute is the attribute which we looking for. Setting it to the value entered in the textbox by the user

SearchResult sResult = Dsearch.FindOne();


A SearchResult represents a single item from a result set.The FindOne method returns a single SearchResult, representing the first result in the underlying result set. Internally, this method is calling the FindAll method and returning the first SearchResult from the SearchResultCollection

if (sResult != null)
{
txtInfo.Content = “This email id already existing”;
}
else
{
txtInfo.Content = “This email id is not found”;
}

That’s it.