Using Powershell To Generate Test Mailboxes

Posted at 3:37 PM on Saturday, August 2, 2008

There are situations where you may want to generate a number of test mailboxes whether it be for a demo or another scenario.  With Exchange 2007, you can leverage Powershell cmdlets to complete this process for you in just seconds.

First, I start out with the a CSV file that contains a limited number of columns, basically the minimum needed to create an Active Directory user account and mailbox-enable it.  Since I have a passion for baseball, my test CSV file is a tribute to some of my favorite players in history.  This is what the sample users.csv file looks like:

UPN,FirstName,LastName,Password
bruth,Babe,Ruth,TestP@ssword1!
mmantle,Mickey,Mantle,TestP@ssword1!
hwagner,Honus,Wagner,TestP@ssword1!
brobinson,Brooks,Robinson,TestP@ssword1!
yberra,Yogi,Berra,TestP@ssword1!
kpuckett,Kirby,Puckett,TestP@ssword1!
rcarew,Rod,Carew,TestP@ssword1!
hkillebrew,Harmon,Killebrew,TestP@ssword1!
twilliams,Ted,Williams,TestP@ssword1!
jdimaggio,Joe,DiMaggio,TestP@ssword1!

Next, it only takes a couple lines of code for us to generate the accounts and mailboxes.  You can take this code and save it into a file named something like createmailboxes.ps1.  This is what the script should look like:

# Test Mailbox Creation Script

# Variables Used Globally
$database = "First Storage Group\Mailbox Database"
$ou = "Users"
$upnsuffix = "@e2k7test.local"

import-csv users.csv | foreach {$pass = ConvertTo-SecureString $_.Password -AsPlainText -Force; New-Mailbox -Name ($_.FirstName+" "+$_.LastName) -Password $pass -UserPrincipalName ($_.UPN+$upnsuffix) -Database $database -OrganizationalUnit $ou -FirstName $_.FirstName -LastName $_.LastName -DisplayName ($_.FirstName+" "+$_.LastName)}

In my script I include some variables that I reuse for all of my users.  In this case, they are all going to be part of the same organizational unit (OU) in Active Directory and their mailboxes will all be part of the same mailbox database.  They are also part of the same domain so the suffix for their User Principal Name (UPN) will be the same.

Literally, the meat of the script is just one line of code thanks for the piping you can do in Powershell.

The import-csv cmdlet takes in a comma-separated text file and lets us read its contents like a data object.  Basically we're taking the contents of the CSV file and passing it into the next segment of code which is the "For Each" block.

Since we want to create an account and mailbox for each line in the CSV file, we'll do that line by line processing within the "For Each" block.  The first command within that block is where we'll save the password as a variable.  Since the password can't be passed into the cmdlet as plain text, we have to convert it to a secure string using the ConvertTo-SecureString cmdlet.  We pass in the plain text password and it returns a secure string that can be used.

Next we call the New-Mailbox cmdlet which will create the account and mailbox enable it.  We'll pass in information like the name of the account, first name, last name, display name, UPN, mailbox database, OU, and password.  There are additional fields that you can include, but are not required.

We can access the different "fields" from the CSV by calling them with the $_.ColumnName format as you can see in the script sample. 

This clearly simplifies the process of bulk account creation and provisioning for Exchange.  We'll work on continuing to evolve this into a more complex script that adds some additional functionality.


Fixing Corrupted Performance Counters

Posted at 8:51 PM on Monday, June 30, 2008

Every once in a while I run into a case where my Windows performance counters go a little whacky.  That is, when I am in Performance Monitor, my objects and their respective counters display text are replaced with a 3-4 integer description instead.  I have no idea how this happens, but this tends to break other things, particularly the Jetstress application which relies on performance counters for it's data.

image

Counter corruption can be seen here where the performance object and counters actual names are replaced by a numeric description

To reload the performance counters, start a Command Prompt and run:

c:\>LODCTL C:\WINDOWS\SYSTEM32\PerfStringBackup.ini

The result will be that when you restart Performance Monitor, your counters again will be readable.  If you are running the x64 version of Windows Server, make sure that you replace SYSTEM32 with SYSWOW64 as this is where the INI file is located.

image

LODCTL can be used to load or re-load as well as repair the performance counters.

My Trip to MMS 2008

Posted at 8:31 PM on Friday, May 2, 2008

I spent the last week in Las Vegas at Microsoft Management Summit 2008.  MMS is a conference that focuses on the technologies that Microsoft offers to manage infrastructure like desktops, servers and beyond.

I hadn't realized how much the technologies had changed in the last several years.  When I was still working for Microsoft I spent a lot of time with my customers working on solutions around Systems Management Server (SMS), Microsoft Operations Manager (MOM), and even had some early adopters of Data Protection Manager (DPM).  SMS is now known as Configuration Manager and DPM is stronger than ever with its new version which protects advanced application data (SQL and Exchange) as well as your existing files and folders.Those technologies have all changed and evolved all underneath one umbrella.  Enter Microsoft System Center.

System Center ties all of these components together.  From deployment of desktops and servers, to asset management, service center (help desk) management, and protecting your data.

My focus for this week was to try to understand how the evolution and advancement of all of these products fits together.  I was particularly interested in learning more about System Center Virtual Machine Manager (SCVMM), Hyper-V, and DPM.

System Center Virtual Machine Manager

SCVMM has a 2007 version which allows you to manage instances of Microsoft Virtual Server from a single MMC.  Those familiar with Virtual Server know that it was administrable only through the web interface.  The change to the MMC seems to be mainstream and provides a lot more functionality.

Microsoft announced the beta availability of SCVMM 2008 during MMS.  SCVMM 2008 brings a number of new features including the ability to manage Hyper-V hosts as well as Virtual Server.  The big feature was received the most attention is it's ability to manage VMware ESX hosts.  Not only can you manage ESX hosts machines and their guests, but you can also initiate VMotion right from within the SCVMM console.  What a powerful feature.   They hit the mark by tying these technologies together and are considering how they can tie other technologies into the mix such as Virtual Iron and Xen.  A Live Migration feature similar to VMotion is also in the works.  It's timing for a release at this point is unknown.

The SCVMM 2008 beta is available for download on the Microsoft Connect website.

Hyper-V

Hyper-V beta is available on x64 builds of Windows Sever 2008 and easily installable by adding the Hyper-V role to your selected server roles in the Server Console.  Hyper-V is not available on the 32-bit platform.

Updates including the release candidate and final code will be downloadable through standard channels like Windows Update.  No special changes will be required to upgrade to the final code.

Once installed, the Hyper-V Manager is installed in the Administrative Tools.  The Hyper-V Manager is similar to SCVMM with less functionality and doesn't include the ability to take advantage of a SCVMM library.  It is also limited to the number of hosts that you can manage.  Obviously, Microsoft wants to encourage you to upgrade to System Center Essentials which allows you to manage up to five Virtual Server or Hyper-V hosts, or for unlimited capabilities, the full-blown System Center suite.

Data Protection Manager

DPM is also part of the System Center umbrella.  DPM's core function is to manage and protect your data by creating regular recovery points and also providing disk to disk backups in addition to disk to tape backups all while the whole entire process is automated.

DPM protection is configurable through a wizard and agent installation.  DPM provides agents to protect your normal files and folders, but also includes advanced protection for transactional data such as SQL or Exchange.  In addition, you can also protect your SharePoint systems and DPM 2007 SP1 will include support for Hyper-V hosts and guests.

In coordination with Microsoft Volume Shadow Copy Services (VSS), a consistent snapshot of data can be taken without having to take applications or services offline.  This allows you to backup applications like SQL or Exchange which normally in most environments must have no service interruptions while they are completely live without skipping a beat. 

The core storage for DPM are fixed disks that are converted to dynamic disks to allow for on-the-fly expandability.  However, DPM can also taken advantage of SAN solutions that offer VSS hardware providers in addition to other integration components.

Microsoft plans to ship Service Pack 1 for DPM in Q4 of 2008.


Fixing the MacBook Pro Sleep Problem

Posted at 10:23 PM on Wednesday, March 26, 2008

One of the things that my MacBook Pro has been plagued with for about the past month is it's inability to go to sleep and wake back up successfully.  Whenever I would open the lid to wake up the system, the screen would be completely blank, even though you hear the system come back on.

I've been searching around looking for the solution and haven't been successfully.  Editing the sleep settings didn't seem to cure anything.  I was trying to correlate what updates had been installed around the time that the problem started.

It seems that the problem started shortly after the Leopard 10.5.2 update.  This update also contained a second update for the graphics driver. 

I came across a thread today on the Mac support forum where someone built a rollback package for the graphics driver would took the driver back to the previous version before the graphics update.

I have put my Mac to sleep several times today and have awaken the system as well with success every time.  I am thrilled to say that this problem is resolved.

At this time, it is confirmed that Apple is aware of the issue and it is a confirmed bug.  There is no timeframe for when an official package to address the issue will be available.

In the time-being, you can check out the thread and if you're up to it, try the rollback package that is available on the thread.  Use this at your own risk.  It has been known to cause problems on some systems.

Update - April 7,2008

Things are still running great after the graphic driver rollback.  I even have gone as far as leaving my VMware Fusion machines running and closing the lid to initiate sleep.  When I return and open the lid, the machine awakens almost immediately. 

I haven't seen any new information on the graphic driver update and the problems it creates, but it is definitely something that Apple needs to be looking at.


IE 8 Beta 1 Now Available

Posted at 6:14 PM on Saturday, March 15, 2008

Internet Explorer Beta 1 is now available for download.  For the first time ever, Microsoft's IE passes the Acid Test, a test designed to check web standards compliance in browsers.

Categories: Vista
Tags:

Comments (0) | del.icio.us | Kick it! | E-mail