Author: Brian

Returned Peace Corps Volunteer, Systems Engineer, Papa, and eccentric individual.

I am constantly conflicted with building my LinkedIn and online persona, and my desire for privacy and anonymity.

And enter the Youtube

My friend Pubert created some videos over the last few months using an incredibly awesome camera which I believe is called an EX-1.  It shoots up to 1200 frames per second.  When played back at normal speeds, those 1200 frames add up to a incredible video ride, even for innocuous seeming water with food coloring.

[youtube]http://www.youtube.com/watch?v=72COEtrtLZk[/youtube]

Exchange Mailbox Move Error 2003 to 2007

After receiving the error on multiple attempts to move the mailbox, I was finally able to get this taken care of.

After first receiving the error I google’d the error code, and came up with various solutions.  First of course was to add permissions to the mailbox:

  • add-mailboxpermissions -id mbx -user (acct doing the moving) -accessrights fullaccess

This really didn’t do anything for me since I had already assigned rights via ADUC

Next was suggested to move the 2003 mailbox to another DB on the 2003 server.  This failed also.

The entire resolution process goes as follows:

  1. exporting 2003 mailbox using exmerge
  2. disconnected mailbox using ADUC
  3. ran mailbox cleanup agent on 2003 DB
  4. reconnected mailbox to dummy user acct (just for backups sake)
  5. created new mailbox using 2007 EMC on the 2007 EVS (this didn’t work… the new mailbox only had SELF permissions on the mailbox rights in ADUC)
  6. removed newly created mailbox using 2007 EMC
  7. removed exchange attributes from 2003 AD user using ADUC
  8. created new Exchange 2003 mailbox using ADUC
  9. moved new 2003 mailbox to 2007 mailbox server (move-mailbox mbx -targetdatabase (evs\sg\db\)
  10. removed “LegacyExchangeDN” from dummy account and created a custom X500 email address on correct user’s ADUC object
  11. opened mailbox in outlook and reimported PST mail
  12. sent test email, and calendar invite
  13. had a near heart-attack and left 45 minutes late from work.

Time to do work?

When I was working at IBM there was a daily report that I issued on the state of the environment, drivespace, and crap like that.  I always told myself that if I ever had time I would automate much or all of the process as thoroughly as possible.  As time was not on my side… that never happened, and instead I browsed my computer for 4 different servers, and 32 different directories every working day just so I knew how much drivespace I *didn’t* have left.

Now that I don’t work for them anymore it is much easier to breathe and script a bit.  Here’s what 2 hours netted me:

# Returns pre-formatted list of drivespace available to all logical drives on given servers
# outputs list to text file

$output = “c:\scripting\mtptfs.txt”
del $output
$evs = @(”evs01″,”evs02″,”evs03″)

foreach ($name in $evs) {
gwmi -computer $name -class win32_volume -filter “drivetype=3″ |
sort-object Caption |
select-object SystemName, Caption,{[math]::round($_.Capacity /1GB, 2)},{[math]::round($_.freespace / 1GB, 2)} >> $output
}

That is a neat little powershell script.  It grabs info from a WMI object of each of my exchange virtual servers, and dumps some numbers to a text file, in a not so classy way.

After another 2 hours I ditched all of that and came to a decent, but not completely done final product:

###
###  Returns pre-formatted list of drivespace available to all
###  exchange virtual servers, and returns the information in a
###  programmatically generated excel spreadsheet
###
�
�
�
### CREATES NEW EXCEL FILE USING COM OBJECT
$Excel = New-Object -Com Excel.Application
$Excel.visible = $True
$Excel = $Excel.Workbooks.Add()

###SETS VARIABLE FOR WORKSHEETS
$p = 1

###CREATES ARRAY FOR WHICH SERVERS TO QUERY
$evs = @(”EVS01″,”EVS02″,”EVS03″)
�
�
�
###LOOP FOR CREATING 1 EXCEL SHEET FOR EACH EVS
foreach ($name in $evs) {

###WRITES COLUMN HEADERS ON EACH EXCEL SHEET
$Sheet = $Excel.WorkSheets.Item($p)
$Sheet.Cells.Item(1,1) = “Computer”
$Sheet.Cells.Item(1,2) = “Drive/MountPoint”
$Sheet.Cells.Item(1,3) = “TOTAL SIZE”
$Sheet.Cells.Item(1,4) = “FREE SPACE”

###CHANGES COLORS AND FONTS ON COLUMN HEADERS
$WorkBook = $Sheet.UsedRange
$WorkBook.Interior.ColorIndex = 8
$WorkBook.Font.ColorIndex = 11
$WorkBook.Font.Bold = $True
�
�
�
###SETS CELL STARTING POINT FOR WRITING EVS & DRIVESPACE INFORMATION
$intRow = 2

###POWERSHELL SCRIPT FOR GETTING WMI INFORMATION ABOUT ALL LOGICAL VOLUMES ON AN EVS
$colItems = gwmi -computer $name -class win32_volume -filter “drivetype=3″ | sort-object Caption

###LOOP FOR WRITING WMI INFORMATION BY ROW
foreach ($objItem in $colItems) {
$Sheet.Cells.Item($intRow,1) = $objItem.SystemName
$Sheet.Cells.Item($intRow,2) = $objItem.Caption
$Sheet.Cells.Item($intRow,3) = $objItem.Capacity / 1GB
$Sheet.Cells.Item($intRow,4) = $objItem.freespace / 1GB
$intRow = $intRow + 1
�
}
�
###CHANGES WORKBOOK TO NEXT SHEET
$p = $p + 1

###ADJUSTS COLUMN WIDTH FOR SHEET AUTOMATICALLY
$WorkBook.EntireColumn.AutoFit()

###FORMATS THE CAPACITY INFORMATION INTO INTEGERS WITH TWO DECIMAL PLACES
$Sheet.Cells.NumberFormat = “#.00″

}

This script is much nicer.  It creates a new excel file using the COM object, and dumps each EVS to its own sheet.  This comes complete with colors.  I have also included the pictures, circles, and arrows on the back of each one, and a paragraph describing what each one was.

I didn’t finish this completely because I ran out of time trying to get the borders completed.

All that being said my 2nd week with powershell is actually a good experience.