Home > Active-Directory, Projects, Server > Scripting up an Active-Directory Test Environment through PowerShell

Scripting up an Active-Directory Test Environment through PowerShell

The first step in building up a Test Environment is analyzing the data that we have to work with. In this case, the Star Trek Reference Csv file.

Since the Csv file doesn’t say sAMAccountName or organizationalUnit I’ve to set up a routine for handling this. Based on the information, I’ve set up the following rules:

User Information

  • Common Name = Character Name
  • sAMAccountName = First 3 Characters from givenName and surName
  • userPrincipalName = sAMAccountName and Domain
  • DisplayName = Character Name
  • givenName = First part of Character Name
  • surName = Last part of Character Name
  • Description = Postition + Species
  • l = Starship
  • streetAddress = Location
  • physicalDeliveryOfficeName = Starship
  • Title = Rank
  • Department = Department
  • Company = Starship
  • mail = CharacterName and Domain

Computer Information

  • Common Name = Starship
  • sAMAccountName = Registry
  • Location = Location
  • Description = Starship

Group Information

  • Common Name = Position
  • Description = Position
  • sAMAccountName = Position

Group MemberShip

  • Members = Based on Users Position

Organizational Unit Structure

  • ou = Series
  • l = Location
  • Description = Starship
  • Child OU: Computers
  • Child OU: Groups
  • Child OU: Users

Users HomeFolder

  • HomeFolder = Based on Users sAMAccountName and a defined Path

Most of these steps may seem trivial and easy to script up based on a Csv file, but there are numerous steps to consider, for example: some Characters, such as T’pol and Phlox don’t have any surnames (at least not any surnames recorded in the Vulcan Database) so these names must be handled in the script. Another step to consider are sAMAccountNames conatining a invalid set of characters and so on. I’m going to go through each step of the scripts and explain in detail how to avoid the exceptions that we might encounter in each new post regarding the migration.

The Scripts will also use the Get-AD.ps1 script when chekcing if objects exist in the Domain.

Next step is Part 1.1: Adding Ou Structure using Powershell

The Get-AD.ps1 script.

Here’s a link to the Csv File refered to in this post.

Rating 3.00 out of 5
[?]
  1. No comments yet.
  1. No trackbacks yet.

Spam Protection by WP-SpamFree