<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Personal website of Dave Hope &#187; Active Directory</title>
	<atom:link href="http://davehope.co.uk/Blog/tag/active-directory/feed/" rel="self" type="application/rss+xml" />
	<link>http://davehope.co.uk</link>
	<description>Open source projects, sysadmin stuff and the home of Product Key Finder</description>
	<lastBuildDate>Fri, 27 Jan 2012 13:47:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Automating Active Directory account creation with Powershell</title>
		<link>http://davehope.co.uk/Blog/automating-active-directory-account-creation-with-powershell/</link>
		<comments>http://davehope.co.uk/Blog/automating-active-directory-account-creation-with-powershell/#comments</comments>
		<pubDate>Thu, 06 Jan 2011 19:09:05 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Exchange]]></category>
		<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://davehope.co.uk/?p=766</guid>
		<description><![CDATA[Earlier this year I set about simplifying the user account creation process for the company I work for. Previously when someone joined the company the user account creation was a manual process. Some of the tasks we manually undertook were: Create the account and Exchange mailbox; Set relevant attributes (Job Title, Office Address etc); Enable [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier this year I set about simplifying the user account creation process for the company I work for. Previously when someone joined the company the user account creation was a manual process. Some of the tasks we manually undertook were:</p>
<ul>
<li>Create the account and Exchange mailbox;</li>
<li>Set relevant attributes (Job Title, Office Address etc);</li>
<li>Enable the user for office communicator;</li>
<li>Set the calendar permissions so that everyone can view the persons calendar;</li>
</ul>
<p>I chose Powershell as my tool of choice, it&#8217;s extremely flexible for stuff like this and most of the management functionality comes out the box with Exchange 2007 and later. I initially used <a href="http://gsexdev.blogspot.com/2010/12/exchange-ews-powershell-module-for-ews.html to set permissions">Glen Scales&#8217; EWS module</a> for setting permissions and other bits but as we moved to Exchange 2010 the need for EWS disappeared (Thanks to functionality like Set-MailboxFolderPermissions).<br />
<span id="more-766"></span><br />
The only third-party software I now use is Quest&#8217;s <a href="http://www.quest.com/powershell/activeroles-server.aspx">ActiveRoles Management Shell for Active Directory</a> as there doesn&#8217;t seem to be a decent way to set custom attributes on a user account. Short of writing my own managed code to do it, or calling another application to make the change Quest&#8217;s tool seems to be the best choice.</p>
<p>I eventually came up with the following quick and dirty script to create users, based on the contents of a CSV file it will:</p>
<ul>
<li>Create the mailbox (uses New-Mailbox);</li>
<li>Set attributes on the AD account such as the job title, office address etc;</li>
<li>Set the default calendar permissions to &#8216;Reviewer&#8217;</li>
<li>Set attributes on the account, enabling it to use Office Communications Server</li>
<li>Generate a welcome letter to the user, including the OWA address and other bits of information</li>
</ul>
<p>The format of the CSV file is as follows:</p>
<pre>GivenName,Surname,Password,PhisicalDeliveryLocation,JobTitle
John,Doe,MyFirstPassword123!,London,Test Account</pre>
<p>And finally, the PowerShell script itself:</p>
<pre>
#
# Create user accounts in AD, Exchange and OCS.
# This script will read a CSV file and create user accounts based on that information.
#
# Requirements:
#  [+] http://www.quest.com/powershell/activeroles-server.aspx (For setting
#      attributes on an AD DS account)
#  [+] Exchange Management Console installed (for Powershell stuff, new-mailbox,
#      Get-MailboxDatabase etc).
#
#import-module activedirectory;
Add-PSSnapin Quest.ActiveRoles.ADManagement

$cfgTab = [char]9
$cfgCompany = &quot;NW Traders&quot;;
$cfgOCSHomeServer = &quot;CN=LC Services,CN=Microsoft,CN=OCSSRV01,CN=Pools,CN=RTC Service,CN=Services,CN=Configuration,DC=nwtraders,DC=msft&quot;; # OCS Server
$cfgMailDomain = &quot;@nwtraders.msft&quot;; #E-Mail Domain

#=============================================================================
# A series of hash tables for office information.
#=============================================================================
$cfgLondon = @{
  &quot;Address&quot; = &quot;10 Downing Street, London, SW1A 2AA&quot;;
  &quot;Telephone&quot; = &quot;+44 2079 250 918&quot;;
  &quot;OU&quot; = &quot;OU=London,OU=Europe,OU=Users,DC=NWTRADERS,DC=MSFT&quot;;
  &quot;DC&quot; = &quot;LONDON&quot; };

$cfgWashington = @{
  &quot;Address&quot; = &quot;The White House, 1600 Pennsylvania Avenue NW, Washington, DC 20500&quot;;
  &quot;Telephone&quot; = &quot;+1 202 456 1414&quot;;
   &quot;OU&quot; = &quot;OU=Washington,OU=US,OU=Users,DC=NWTRADERS,DC=MSFT&quot;;
  &quot;DC&quot; = &quot;WASHINGTON&quot; };

#=============================================================================
# Creates an array of the above hash tables.
#=============================================================================
$cfgOffices = @{
  &quot;London&quot; = $cfgLondon;
  &quot;Washington&quot; = $cfgWashington;
  };

#=============================================================================
# Displays a select file dialog box, returning the path to a CSV file.
#=============================================================================
function chooseCSVfile
{
	param([string]$Title,[string]$Directory,[string]$Filter=&quot;CSV Files (*.csv)|*.csv&quot;)
	[System.Reflection.Assembly]::LoadWithPartialName(&quot;System.Windows.Forms&quot;) | Out-Null
	$openFileDialog = New-Object System.Windows.Forms.OpenFileDialog
	$openFileDialog.InitialDirectory = $Directory
	$openFileDialog.Filter = $Filter
	$openFileDialog.Title = $Title
	$openFileDialog.ShowHelp = $true

	$Show = $openFileDialog.ShowDialog()

	If ($Show -eq &quot;OK&quot;)
	{
		Return $openFileDialog.FileName
	}
	Else
	{
		Exit
	}
}

#=============================================================================
# Generate welcome e-mail.
#=============================================================================
Function generateIntroLetter
{
	param( [string]$GivenName, [string]$samAccountName, [string]$Password, [string]$DisplayName, [string]$DomainController )

	$tmpServer = get-mailbox $DisplayName -DomainController $DomainController | select servername
	$tmpOWA = get-OutlookAnywhere -Server $tmpServer.ServerName -DomainController $DomainController -ADPropertiesOnly | select ExternalHostname
	$tmpOWA = &quot;https://&quot; + $tmpOWA.ExternalHostname + &quot;/owa/&quot;

	$rtfBuilder = new-object system.text.stringbuilder 

	# Append RTF header
	$null = $rtfBuilder.Append(&quot;{\rtf1\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{\f0\fswiss\fprq2\fcharset0 Calibri;}{\f1\fnil\fcharset0 Calibri;}}&quot;)
	$null = $rtfBuilder.Append(&quot;`r`n&quot;) 

	# Append RTF color table which will contain all Powershell console colors.
	#$null = $rtfBuilder.Append('{\colortbl ;\red0\green0\blue255;}')
	#$null = $rtfBuilder.Append(&quot;`r`n&quot;) 

	$null = $rtfBuilder.Append(&quot;{\*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\pard\sa200\sl276\slmult1\f0\fs22 Dear $GivenName,\par&quot;)
	$null = $rtfBuilder.Append(&quot;`r`n&quot;)
	$null = $rtfBuilder.Append(&quot;Please find the below access credentials for the NW Traders network. These are the only credentials you should need at NW Traders and will log you into your computer, e-mail account and other systems. As such, they should be kept confidential.\par&quot;)
	$null = $rtfBuilder.Append(&quot;`r`n&quot;)
	$null = $rtfBuilder.Append(&quot;\tab Username\tab\tab $samAccountName\line\tab Password\tab\tab $PlainPassword\line\tab Domain\tab\tab\tab NWTRADERS\par&quot;)
	$null = $rtfBuilder.Append(&quot;`r`n&quot;)
	$null = $rtfBuilder.Append(&quot;It is highly recommended that you change your password the first time you login. You should be able to use Outlook both in the office and at home, if for some reason that is not available you can access webmail using the following address:\par&quot;)
	$null = $rtfBuilder.Append(&quot;`r`n&quot;)
	$null = $rtfBuilder.Append(&quot;\pard\tab{\field{\*\fldinst{HYPERLINK `$tmpOWA`}}{\fldrslt{\ul\cf1 h$tmpOWA}}}\f0\fs22\pard\par&quot;)
	$null = $rtfBuilder.Append(&quot;\pard\par&quot;)
	$null = $rtfBuilder.Append(&quot;`r`n&quot;)
	$null = $rtfBuilder.Append(&quot;If you require support please contact the IT Support team via e-mail, {\field{\*\fldinst{HYPERLINK `mailto:it@nwtraders.msft` }}{\fldrslt{\cf1\ul it@nwtraders.msft}}}\cf0\ulnone\f0\fs22 . Alternatively an increasing number of self-service resources are available on our intranet:\par&quot;)
	$null = $rtfBuilder.Append(&quot;`r`n&quot;)
	$null = $rtfBuilder.Append(&quot;\pard\fi720\par&quot;)
	$null = $rtfBuilder.Append(&quot;\pard\fi720{\field{\*\fldinst{HYPERLINK `http://intranet/`}}{\fldrslt{\ul\cf1 http://intranet/}}}\f0\fs22\par&quot;)
	$null = $rtfBuilder.Append(&quot;`r`n&quot;)
	$null = $rtfBuilder.Append(&quot;\pard\sa200\sl276\slmult1\par&quot;)
	$null = $rtfBuilder.Append(&quot;`r`n&quot;)
	$null = $rtfBuilder.Append(&quot;Kind Regards,\par&quot;)
	$null = $rtfBuilder.Append(&quot;`r`n&quot;)
	$null = $rtfBuilder.Append(&quot;\par&quot;)
	$null = $rtfBuilder.Append(&quot;`r`n&quot;)
	$null = $rtfBuilder.Append(&quot;IT Support.\lang9\f1\par&quot;)
	$null = $rtfBuilder.Append(&quot;`r`n&quot;)
	$null = $rtfBuilder.Append(&quot;}&quot;)

	# Save as RTF File.
	echo $rtfBuilder.ToString() | out-file -Encoding Ascii &quot;$samAccountName.rtf&quot;
}

#=============================================================================
# Displays a list of mailbox databases, which the user needs to choose from.
#=============================================================================
Function chooseMailboxDatabase()
{
	$MbDbase = Get-MailboxDatabase
	$NumOfDB = $MbDbase.Count
	$Number = 0
	$Choice = 0

	If ($NumOfDB -eq $Null)
	{
		Write-Host $MbDbase.Identity
		return $MbDbase.Identity
	}
	else
	{
		foreach ($mbxDB in $MbDbase)
		{
			Write-Host &quot;$Number . &quot; $MbxDB.Identity
			$Number ++
		}
		Write-Host &quot;&quot;
		$Choice = Read-Host &quot;Mailbox Database&quot;
		return $MbDbase[$Choice].Identity
	}
}

#=============================================================================
# Opening user detail list&quot;
#=============================================================================
$FileName = chooseCSVfile -Title &quot;Import an CSV file&quot; -Directory &quot;c:\&quot;
$UserInformation = Import-Csv $FileName

#=============================================================================
# Do some logic about our environment.
#=============================================================================
Foreach ($User in $UserInformation)
{
	$SurName = $User.Surname
	$GivenName = $User.givenName
	$samAccountName = $GivenName + &quot; &quot; + $SurName
	$DisplayName = $SurName + &quot;, &quot; + $GivenName
	$PlainPassword = $User.Password
	$userPrincipalName = $samAccountName + $cfgMailDomain

	#Exchange Specific
	$strMailAddress = $samAccountName -replace &quot; &quot;, &quot;.&quot;;
	$strMailAddress += $cfgMailDomain;
	$strMailAlias = $samAccountName -replace &quot; &quot;, &quot;.&quot;;

	# Attributes.
	$strOffice = $User.PhisicalDeliveryLocation;
	$strTitle = $user.JobTitle;
	$strOU	= $cfgOffices.Get_Item( $strOffice ).Get_Item(&quot;OU&quot;)
	$strOAddress = $cfgOffices.Get_Item( $strOffice ).Get_Item(&quot;Address&quot;);
	$strOTel = $cfgOffices.Get_Item( $strOffice ).Get_Item(&quot;Telephone&quot;);

Write-Host -Foreground Gray &quot;---------------------------------------------------------------&quot;
Write-Host -Foreground Red &quot; &quot;$DisplayName
Write-Host -Foreground Gray &quot;---------------------------------------------------------------&quot;
	Write-Host &quot; Username:&quot;$cfgTab$samAccountName;
	Write-Host &quot; Password:&quot;$cfgTab$PlainPassword;
	Write-Host &quot; Job Title:&quot;$cfgTab$strTitle;
	Write-Host &quot; OU:&quot;$cfgTab$cfgTab$strOU;
	Write-Host &quot; E-Mail:&quot;$cfgTab$strMailAddress
Write-Host -Foreground Gray &quot;---------------------------------------------------------------&quot;
Write-Host &quot;&quot;

	# Choose a mailbox database for this account.
	$mbDatabase = chooseMailboxDatabase
	Write-Host &quot;&quot;
	Write-Host -Foreground Gray &quot;---------------------------------------------------------------&quot;

	# Lets actually create the account now.
	$Password = ConvertTo-SecureString $PlainPassword -AsPlainText -Force

	# Create Exchange mailbox.
	New-Mailbox -Name $DisplayName -Alias $strMailAlias -OrganizationalUnit $strOU -UserPrincipalName $userPrincipalName -SamAccountName $samAccountName -FirstName $GivenName -Initials '' -LastName $SurName -Password $Password -ResetPasswordOnNextLogon $false -Database $mbDatabase -DomainController $cfgOffices.Get_Item( $strOffice ).Get_Item(&quot;DC&quot;)  | out-null

	# Set Quest Active Directory stuff to use a DC in the local site (mostly).
	# Otherwise trying to make exchange changes in a remote site using a local
	# DC is going to fail, since the account doesn't exist yet.
	Connect-QADService -service $cfgOffices.Get_Item( $strOffice ).Get_Item(&quot;DC&quot;) | out-null

	# Set attributes on AD DS account.
	Get-QADUser $DisplayName | set-qaduser -oa @{'Office'=$strOffice; 'StreetAddress'=$strOAddress; 'OfficePhone'=$strOTel; 'Company'=$cfgCompany; 'Title'=$strTitle } | out-null

	# Set calendar permissions.
	Set-MailboxFolderPermission -Identity $strMailAddress`:\Calendar -User Default -AccessRights Reviewer -DomainController $cfgOffices.Get_Item( $strOffice ).Get_Item(&quot;DC&quot;)  | out-null

	# Create the OCS Account.
	Get-QADUser $DisplayName | set-qaduser -oa @{'msRTCSIP-ArchivingEnabled'=0; 'msRTCSIP-FederationEnabled'=$true; 'msRTCSIP-InternetAccessEnabled'=$true; 'msRTCSIP-OptionFlags'=257; 'msRTCSIP-UserEnabled'=$true; 'msRTCSIP-PrimaryHomeServer'=$cfgOCSHomeServer; 'msRTCSIP-PrimaryUserAddress'=(&quot;sip:&quot; + $strMailAddress ).ToString() } | out-null

	# Disconnect QADService.
	disconnect-qadservice

	# Generate Welcome e-mail.
	generateIntroLetter -GivenName $GivenName -samAccountName $samAccountName -Password $PlainPassword -DisplayName $DisplayName -DomainController $cfgOffices.Get_Item( $strOffice ).Get_Item(&quot;DC&quot;)
}
</pre>
<p>You can expect outlook similar to the below:</p>
<pre>---------------------------------------------------------------
<span style="color:red">  Doe, John</span>
---------------------------------------------------------------
 Username:      John Doe
 Password:      MyFirstPassword123!
 Company:       NW Traders
 Job Title:     Test Account
 OU:            OU=London,OU=Europe,OU=Users,DC=NWTRADERS,DC=MSFT
 E-Mail:        John.Doe@nwtraders.msft
---------------------------------------------------------------

0 .  LONDON
1 .  WASHINGTON

Mailbox Database: 0
---------------------------------------------------------------</pre>
<p>You can then send the resulting RTF document to the persons line manager, or whoever should have it for when the employee starts on their first day.</p>
<p>I should note, Andy Grogan (Exchange MVP) <a href="http://www.telnetport25.com/en/component/content/article/15-powershell/332-creating-mailbox-users-in-powershell-from-a-csv-and-then-merging-the-details-into-microsoft-word.html">has a very similar tool</a> which you might like to take a look at. I gleaned the Open-CSV idea and plagiarised the choose mailbox database code from him.</p>
]]></content:encoded>
			<wfw:commentRss>http://davehope.co.uk/Blog/automating-active-directory-account-creation-with-powershell/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Deleting the TFS workspace for a missing account fails (TF50605)</title>
		<link>http://davehope.co.uk/Blog/deleting-the-tfs-workspace-for-a-missing-account-fails-tf50605/</link>
		<comments>http://davehope.co.uk/Blog/deleting-the-tfs-workspace-for-a-missing-account-fails-tf50605/#comments</comments>
		<pubDate>Thu, 13 May 2010 14:24:40 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Team Foundation Server]]></category>

		<guid isPermaLink="false">http://davehope.co.uk/?p=557</guid>
		<description><![CDATA[Having decommissioned a few legacy AD DS domains over the last year or so we&#8217;ve had a few references in TFS to missing accounts. When attempting to delete the workspace you get the following error: TF50605: There was an error looking up the SID for OLD-DOMAIN\CCNETNIGHTLYBUILD. In order to delete the workspace, we need to [...]]]></description>
			<content:encoded><![CDATA[<p>Having decommissioned a few legacy AD DS domains over the last year or so we&#8217;ve had a few references in TFS to missing accounts. When attempting to delete the workspace you get the following error:</p>
<pre>TF50605: There was an error looking up the SID for OLD-DOMAIN\CCNETNIGHTLYBUILD.</pre>
<p>In order to delete the workspace, we need to remap it to a valid user account. Here&#8217;s the process to do just that.<br />
<span id="more-557"></span><br />
Firstly, we should list the workspaces on this computer we&#8217;re having problems with (in this case, BUILDSERVER01).</p>
<pre>C:\&gt;tf workspaces /owner:* /server:http://tfs-server:8080 | findstr BUILDSERVER01
Workspace		Owner				Computer	Comment
----------------------- ------------------------------- --------------- -------------------------------
BUILDSERVER01		saCCNetNightly			BUILDSERVER01	Temporary CruiseControl.NET Wo
BUILDSERVER01		OLD-DOMAIN\CCNETNIGHTLYBUILD	BUILDSERVER01 	Temporary CruiseControl.NET Wo
BUILDSERVER01		saCCNetNightly			BUILDSERVER01
</pre>
<p>We may as well attempt to delete the workspace, though the process is likely to fail as it wont be able to resolve the SID if the domain is no longer available.</p>
<pre>C:\&gt;tf workspace /delete /server:http://tfs-server:8080 BUILDSERVER01;OLD-DOMAIN\CCNETNIGHTLYBUILD
<span style="color: red;">TF50605: There was an error looking up the SID for OLD-DOMAI\CCNETNIGHTLYBUILD.</span></pre>
<p>At this point, we need to open up the <em>TfsVersionControl </em>table and manually point the workspaces to a valid identity. The first stage is to identify the ID of the missing account:</p>
<pre>SELECT IdentityId FROM tfsVersionControl.tbl_Identity WHERE (DisplayName LIKE 'OLD-DOMAIN\CCNETNIGHTLYBUILD')</pre>
<p>Now that we have the ID, we can locate the workspaces the owner has on the server we&#8217;re having problems with.</p>
<pre>SELECT WorkspaceId, OwnerId, WorkspaceName FROM tfsVersionControl.tbl_Workspace WHERE (OwnerId = 311) AND (Computer = 'BUILDSERVER01')</pre>
<p>We should now update the <em>tfsVersionControl.tbl_Workspace</em> table with a valid IdentityId from the <em>tfsVersionControl.tbl_Identity</em> table. Once that&#8217;s done, try the delete command again:</p>
<pre>C:\&gt;tf workspace /delete /server:http://tfs-server:8080 "BUILDSERVER01;Dave Hope"
A deleted workspace cannot be recovered.
Workspace 'BUILDSERVER01;Dave Hope' on server 'http://tfs-server:8080' has 0 pending change(s).
Are you sure you want to delete the workspace? (Yes/No) Yes</pre>
<p>And hey presto, the workspace is gone.</p>
]]></content:encoded>
			<wfw:commentRss>http://davehope.co.uk/Blog/deleting-the-tfs-workspace-for-a-missing-account-fails-tf50605/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Join Ubuntu to Active Directory</title>
		<link>http://davehope.co.uk/Blog/join-ubuntu-to-active-directory/</link>
		<comments>http://davehope.co.uk/Blog/join-ubuntu-to-active-directory/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 12:09:01 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://davehope.co.uk/?p=517</guid>
		<description><![CDATA[Having recently deployed a handful of Ubuntu Linux systems for proxies and other roles I wanted to join them to Active Directory for Single Signon. Nobody wants to remember lots of different passwords, lets face it. I came across a product called Likewise, the free open-source version is available in the standard Ubuntu repositories. Here&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Having recently deployed a handful of Ubuntu Linux systems for proxies and other roles I wanted to join them to Active Directory for Single Signon. Nobody wants to remember lots of different passwords, lets face it.</p>
<p>I came across a product called <a href="http://www.likewise.com/">Likewise</a>, the free open-source version is available in the standard Ubuntu repositories. Here&#8217;s a quick guide for how to get up and running with likewise-open.</p>
<p>Firstly, install Likewise.</p>
<pre>$ sudo aptitude install likewise-open</pre>
<p><span id="more-517"></span><br />
The final part of the installation will prompt you for some information about your Active Directory domain. If you need to change the settings you enter here run <em>dpkg-reconfigure krb5-config</em>.</p>
<p><a href="http://davehope.co.uk/wp-content/uploads/2010/02/Likewise-Servers.png"><img width="550" height="357" class="aligncenter" title="Likewise-Servers" src="/wp-content/uploads/2010/02/Likewise-Servers-m.png" alt="Likewise Active Directory Domain Controllers" /></a></p>
<p>The second screen asks you for an administrative domain controler where password changes will occur.</p>
<p><a href="http://davehope.co.uk/wp-content/uploads/2010/02/Likewise-Administrative.png"><img width="550" height="356" class="aligncenter" title="Likewise-Administrative" src="/wp-content/uploads/2010/02/Likewise-Administrative-m.png" alt="Administrative server for Likewise" /></a></p>
<p>With the installation complete we now need to join the system to the Active Directory domain, this is accomplished with one simple command.</p>
<pre>$ sudo domainjoin-cli join NWTRADERS.MSFT Administrator</pre>
<p><a href="http://davehope.co.uk/wp-content/uploads/2010/02/Likewise-DomainJoin.png"><img width="550" height="357" src="/wp-content/uploads/2010/02/Likewise-DomainJoin-m.png" alt="Likewise Domain Join" title="Likewise-DomainJoin" class="aligncenter" /></a></p>
<p>I then wanted domain admins to be able to use sudo. This can easily be achieved by adding the following to the end of the <em>/etc/sudoers</em> file.</p>
<pre>%NWTRADERS\\domain^admins ALL=(ALL) ALL</pre>
]]></content:encoded>
			<wfw:commentRss>http://davehope.co.uk/Blog/join-ubuntu-to-active-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing a child domain that no longer exists</title>
		<link>http://davehope.co.uk/Blog/removing-a-child-domain-that-no-longer-exists/</link>
		<comments>http://davehope.co.uk/Blog/removing-a-child-domain-that-no-longer-exists/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 19:00:11 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Active Directory]]></category>

		<guid isPermaLink="false">http://davehope.co.uk/?p=141</guid>
		<description><![CDATA[I was asked to remove a child domain at work today. Usually that wouldn&#8217;t be a problem but unfortunately the final DC had been wiped and not been dcpromo&#8217;d (Cleanly removed from the domain). So I thought I&#8217;d document the process should anyone else find themselves in a similar situation. To do most of the [...]]]></description>
			<content:encoded><![CDATA[<p>I was asked to remove a child domain at work today. Usually that wouldn&#8217;t be a problem but unfortunately the final DC had been wiped and not been dcpromo&#8217;d (Cleanly removed from the domain).</p>
<p>So I thought I&#8217;d document the process should anyone else find themselves in a similar situation. To do most of the below, you&#8217;ll need to be an Enterprise Admin.</p>
<ol>
<li>Remove all the DNS entries for the missing DCs and the child domain. Make sure you get the GUID entries too.</li>
<li>Fire up ntdsutil and follow the below steps. When you select a server to connect to, connect to the operation master.<br />
<code>ntdsutil: <strong>metadata cleanup</strong><br />
metadata cleanup:<br />
metadata cleanup: <strong>connections</strong><br />
server connections:<br />
server connections: <strong>connect to server london.nwtraders.msft</strong><br />
Binding to london ...<br />
Connected to london using credentials of locally logged on user<br />
server connections:<br />
server connections: <strong>quit</strong><br />
metadata cleanup:<br />
metadata cleanup: <strong>select operation target</strong><br />
select operation target:<br />
select operation target: <strong>list domains</strong><br />
Found 2 domain(s)<br />
0 - DC=nwtraders,DC=msft<br />
1 - DC=child,DC=nwtraders,DC=msft<br />
select operation target:<br />
select operation target: <strong>select domain 1</strong><br />
No current site<br />
Domain - DC=child,DC=nwtraders,DC=msft<br />
No current server<br />
No current Naming Context<br />
select operation target:<br />
select operation target: <strong>quit</strong><br />
metadata cleanup:<br />
metadata cleanup: <strong>remove selected domain</strong><br />
</code></p>
<p>Depending on the exact situation, you may get an error about needing to remove a server first (Sorry, I can&#8217;t recall the exact error). If you do, there&#8217;s an extra step you need to undertake first.</p>
<p><code>ntdsutil: <strong>metadata cleanup</strong><br />
metadata cleanup:<br />
metadata cleanup: <strong>connections</strong><br />
server connections:<br />
server connections: <strong>connect to server london.nwtraders.msft</strong><br />
Binding to london ...<br />
Connected to london using credentials of locally logged on user<br />
server connections:<br />
server connections: <strong>quit</strong><br />
metadata cleanup:<br />
metadata cleanup: <strong>select operation target</strong><br />
select operation target:<br />
select operation target: <strong>list sites</strong><br />
Found 1 site(s)<br />
0 - CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=nwtraders,DC=msft<br />
select operation target:<br />
select operation target: <strong>select site </strong><br />
Site - CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=nwtraders,DC=msft<br />
No current domain<br />
No current server<br />
No current Naming Context<br />
select operation target:<br />
select operation target: <strong>list servers in site</strong><br />
Found 1 server(s)<br />
0 - CN=brisbane,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=nwtraders,DC=msft<br />
select operation target: <strong>select server 0</strong><br />
</code><br />
Then repeat the first process to remove the server (remove selected server).</li>
<li>Open up Active Directory Sites And Services and remove any stranded servers.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://davehope.co.uk/Blog/removing-a-child-domain-that-no-longer-exists/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

