Tuesday, 21 August 2012

Active Directory in the Rackspace Cloud

Wow. My first post in ages! There are LOADS of new and exciting features taking place all over the various clouds these days. As such, this is a quick guide I threw together that goes through the few steps required to set-up Active Directory within the Rackspace Cloud. I am using their new OpenStack gear, but this same process should work without issue on the First-Gen gear too.

A few assumptions...
  • You are an existing Rackspace Cloud customer. (free sign up)
  • You know enough about AD and Windows Server in general to follow along with this light guide
  • You know what to do once the AD role as been installed
OK - let's role.
  1. Log into your Rackspace account and create a new slice, and since this is only for testing purposes, use the smallest slice you can get your hands on (1.0 GB RAM, 40 GB Disk, 1 vCPU). Make note of your administrator password.
  2. Once launched, login via RDP or the local console, download and install your favorite AV client.
  3. (optional) Download and install Firefox or Chrome. I find it much easier to navigate the web on a fresh Windows install with one of these.
  4. Set time zone - not required, but good to do so now.
  5. Enable and start Remote Registry. Very important, you will not get far without.
  6. Remove any roles you don't need (i.e. IIS) and all of their dependant features. Reboot.
  7. Enable Active Directory Domain Services. Reboot. 
  8. Run dcpromo.exe - populate the text boxes with your new domains values. Reboot.
Once you get here you are nearly set. You can tweak your DNS if need be and your LAN settings but the out-of-the-box values from RAX work just fine.

The next, and somewhat painful step, is configuring the network rules to allow the various types of AD traffic. This is a great helper if you don't have them all for memory. http://technet.microsoft.com/en-us/library/dd772723(v=WS.10).aspx. One tip is to restrict RPC to a specific port(s).

Good luck!

Tuesday, 14 August 2012

Sending email through Amazon SES with PowerShell

Amazon Simple Email Service (Amazon SES) is a highly scalable and cost-effective bulk and transactional email-sending service for businesses and developers. 

Here is a pretty basic PowerShell script that will send email through Amazon SES SMTP interface. This assumes you already have SES enabled, and you at least have access to send email from the SES sandbox – an environment specifically designed for developers to test and evaluate the service.

$smtpServer = "email-smtp.us-east-1.amazonaws.com" 
$smtpPort = 587  
$username = "your username"
$password = "your password"  
$from = "[email protected]"
$to = "[email protected]"
$subject = "Test e-mail with PowerShell"
$body = "This is a test e-mail sending with using PowerShell"

$smtp = new-object Net.Mail.SmtpClient($smtpServer, $smtpPort)
$smtp.EnableSsl = $true 

$smtp.Credentials = new-object Net.NetworkCredential($username, $password)
$msg = new-object Net.Mail.MailMessage
$msg.From = $from
$msg.Subject = $subject
$msg.Body = $body