Exchange 2007 backup script updated to v1.2

By Scott, August 21, 2008 10:51 AM

I added notification of what the checkmark means, automatically load the Exchange snapin if not already, and append the subject of the email with a status summary.  If there are no backups that need attention, all okay is added.  If there are, it says that attention is needed.  This provides a quick way to know if anything needs attention.  Download the script here.

Another minor update to the Exchange 2007 backup script

By Scott, August 11, 2008 4:00 PM

Version 1.11 correctly resets the checkmark status during each loop; when cleared before because no backup has taken place, it remained as a null value for later backups that were successful.  Updated version is available here.

Updated Exchange 2007 database backup script

By Scott, August 8, 2008 6:57 PM

I have made some minor updates to my PowerShell script that reports (and emails) the last backup of each database in your organization.  I was referencing the wrong variable when looping through the databases in a storage group, so each storage group in the report listed all the databases on the server.  I also change the formatting a little so the text in different table cells in the same row actually look to be in the same row (the checkmark was offsetting that cell a bit).  You can download v1.1 here.

PowerShell script to report last successful full backup of Exchange 2007

By Scott, July 22, 2008 7:28 AM

Edit: The inline code in this post is not the latest version of the script. Get the latest version from the downloads page.

This script is a port of my original backup report that was written in VBScript.  That script reports on both 2003 and 2007 servers, but lacked some of the features that I wanted to put in.  PowerShell natively supports date-awareness, which makes it much easier to add the number one feature I wanted to add: highlighting servers that haven’t had backups since a specified period of time.

Because I am using the native Exchange cmdlets instead of WMI or CDOEXM, this only reports on Exchange 2007 servers.  I figure accommodating both is more work than it is worth, so I just modified my VBScript version to not include any server in the Exchange 12 admin group and I have both run every day until my migration to 2007 is complete.

The script reports the last successful full backup of any Exchange 2007 server with the mailbox role installed.  It checks for the presence of storage groups and databases within them.  It notes if a backup is currently in progress, as well as if a backup has never completed.  If a backup has not completed in the last 72 hours (modifiable), it is highlighted in red so it is easy to spot.  If a backup is less than the defined number of hours old, I use the Marlett font to display a green checkmark.  This allows for a checkmark without having to reference an external image or embed one.  Lastly, the report is emailed.  The script is shown below, but you can also just download it.

#Last Backup Report for Exchange 2007 servers
#Version 1.0 - 7/9/08
#--------------------------------------------

#Begin customization-------------------------
$SmtpServer = "server.domain.com" #Enter FQDN of SMTP server
$SmtpFrom = "Exchange Backups <exchangebackupreport@domain.com>" #Enter sender email address
$SmtpTo = "user1@domain.com","user2@domain.com" #Enter one or more recipient addresses in an array
$SmtpSubject = "Exchange 2007 Last Backup Report" #Enter subject of message
$iNomHours = "72" #Enter number of hours since last backup that requires attention
#End customization---------------------------

$date = Get-Date
$sSpace = "&nbsp;&nbsp;&nbsp;&nbsp;"
$sOutput = "<table>"

#Checkmark to indicate last backup within nominal time
$sCheckMark = "<span style=""font-family: Marlett; color: green; font-size: 14pt; font-weight: bold"">a</span>"

#Retrieve Exchange servers with mailbox role
$ExServer = Get-ExchangeServer | where {$_.IsMailboxServer -eq $True} | Sort-Object Name
Foreach ($server in $ExServer)
	{
	$sOutput += "<tr><td><font size=2><u><b>$server</b></u></font></td><td></td></tr>"
	#Retrieve storage groups for a given server
	$StorageGroup = $server | Get-StorageGroup | Sort-Object Name
	#Check for absence of any storage groups
	If (($StorageGroup | Measure-Object Name).Count -eq $null)
		{
		$sOutput += "<tr><td><font size=2>" + $sSpace + "No storage groups present.</font></td></tr>"
		}
	Else
		{
		Foreach ($sg in $StorageGroup)
			{
			$sOutput += "<tr><td><font size=2>" + $sSpace + $sg.Name + "</font></td></tr>"
			#Retrieve mailbox databases for a given storage group
			$MailboxDatabase = $StorageGroup | Get-MailboxDatabase -Status | Sort-Object Name
			#Check for absence of any databases in storage group
			If (($MailboxDatabase | Measure-Object Name).Count -eq $null)
				{
				$sOutput += "<tr><td><font size=2>" + $sSpace + $sSpace + "No mailbox stores present.</font></td></tr>"				}
			Else
				{
				Foreach ($db in $MailboxDatabase)
					{
					$sBackupRunning = ""
					#Note if backup is currently running
					If ($db.BackupInProgress -eq $true)
						{$sBackupRunning = "<font size=2 color=blue>(Backup In Progress)</font>"}
					#Determine if backup has ever completed
					If ($db.LastFullBackup -ne $null)
						{
						$sBackupDay = $db.LastFullBackup.get_DayofWeek()
						$sBackupDateTime = $db.LastFullBackup.ToString("g")
						#Flag if last completed backup started longer than defined variable
						If (($date - $db.LastFullBackup).TotalHours -gt $iNomHours)
							{
							$sLastBackup = "<font size=2>Last Backup Started At: <font color=red>" + $sBackupDay + ", " + $sBackupDateTime + "</font></font>"
							}
						Else
							{
							$sLastBackup = "<font size=2>Last Backup Started At: " + $sBackupDay + ", " + $sBackupDateTime + " </font>" + $sCheckmark
							}
						}
					Else
						{
						$sLastBackup = "<font size=2>No full backup has completed yet.</font>"
						}
					$sOutput += "<tr><td><font size=2>" + $sSpace + $sSpace + $db.Name + " </font></td><td>" + $sLastBackup + $sBackupRunning + "</td></tr>"
					}
				}
			}
		}
	}
$sOutput += "</table>"

#Email results
$SmtpClient = New-Object System.Net.Mail.SmtpClient
$MailMessage = New-Object System.Net.Mail.MailMessage
$SmtpClient.Host = $SmtpServer
$MailMessage.From = $SmtpFrom
Foreach ($address in $smtpTo)
	{$MailMessage.To.Add($address)}
$MailMessage.Subject = $SmtpSubject
$MailMessage.IsBodyHTML = $true
$MailMessage.Body = $sOutput
$SmtpClient.Send($MailMessage)

Pocket Controller skin for AT&T tilt

By Scott, June 24, 2008 10:16 AM

If you use SOTI’s Pocket Controller Professional to control your Windows Mobile device from your desktop, you know that you can display the screen in a skin and control the virtual hardware buttons in PCP.  You can download skins from within PCP, but only during the first year of purchase.  They consider the skin catalog a "service."  After the year is up, you have to purchase the application again (at an upgrade price), which includes product upgrades for the year, too.  However, PCP hasn’t even been updated in a year, so it seems a pretty cheap way to earn revenue, considering SOTI even solicits images from customers to add to the skin catalog.  (They used to provide the entire skin catalog free of charge.)

My work installation is beyond the one year of service, so I couldn’t download a skin for my AT&T Tilt.  My home installation (separate license), however, was within the service year, so I downloaded the skin and copied it to my work installation.  I could not find anything in the program or on SOTI’s site regarding copyright of the skin images, so I am posting the Tilt images (displayed half-size) for anyone who needs it.

Tilt vertical image

Tilt horizontal image

Cannot enter a product key for a 64-bit Exchange 2007 server from the 32-bit management tools

By Scott, June 4, 2008 10:42 AM

The 32-bit version of Exchange 2007 cano be used in a non-production environment only.  As such, there is no need to license the product by entering a product key.  Doing so will only result in the error "Invalid product key".

A side effect of this limitation is that you can also not enter a product key for a valid 64-bit server from a 32-bit installation such as the management tools on a 32-bit OS.  I have a PowerShell script that configures a server, depending on the roles that are installed.  However, the first thing it does for all servers is apply the product key.  This fails because I am running my configuration script from a 32-bit management installation.

I consider this a bug.  The only solution is to run the Set-ExchangeServer command with the -ProductKey parameter on a 64-bit installation of the management tools.

Going to see MercyMe for fourth time. Woohoo!

By Scott, June 1, 2008 5:17 PM

MercyMe goes to a lot of places for touring, but they don’t seem to hit Portland very often.  Two of the three times I have gone to see them has been in the metro area, with the other being up in Washington for a county fair.  Perhaps this is because Oregon, based on some metric, is the most unchurched state in the country.  I like to think that we may have fewer regular Sunday service attendees per capita, but that we make up for it by having a much higher percentage of those who actually have a personal relationship with Jesus.

This time, Jen and I will be traveling four hours and 270 miles to the booming metropolis of Central Point, where they will be performing with Casting Crowns on July 27.  The drive will be worth it since we have seats in Row 2 (!!), which will be the best seats we have ever had seeing them.

I look forward to seeing them since they are my favorite CCM band, along with Chris Tomlin.  And I look forward to Bart’s new Hymned album, which he has already recorded and I assume will come out later this year.  If you are a poor, lost soul who hasn’t had the opportunity to listen to MercyMe, go to their website to hear them, or visit their blog to see how even grown men can be childish at heart.

Replace the starter string on a Ryobi 875r trimmer

By Scott, May 23, 2008 4:22 PM

For the second time since I have owned it, the starter string on my Ryobi multi-attachment trimmer broke.  Must be poor design causing too much friction and slowing wearing down the nylon until it frays and breaks.

One of the difficult parts to remove, if you haven’t done it before, is the clutch drum.  To do so, you need to remove spark plug and insert a screw driver into the combustion chamber to keep the piston from moving.  Then use a Torx 15 driver and insert it into the whole in the front of the drum.  Turn the driver counter-clockwise while holding the engine/chassis still to remove the screw holding the drum in place.

After you remove the springs holding the clutch together, loosen the clutch with a wrench and remove it.  Then you can remove the gray plastic cover that houses the starter string, pulley, and spring.  When you remove the pulley retaining parts, you can lift out the pulley.  You need to be careful when doing so because the spring will uncoil all over the place if you don’t reign it in while lifting the pulley out.

I slowly let the spring uncoil so I can work with the pulley.  Now you can replace the broken string.  The frustrating part for me at this point was keeping the spring in place while trying to attache the pulley.  After several failed attempts, I figured out a better way.  I was trying to mount the pulley with the string wound around it, which means that the spring has to be uncoiled a bit.  But this leads to the spring not wanting to remain flat when the pulley is being mounted on the shaft.  The better thing to do is to unwind the the starter string so it is fully extended.  You can then wind the spring as tight as it will go around the pulley (less one or two revolutions).

Even though the spring has more potential energy at this point, there is enough friction between each revolution of the spring that it makes it less prone to want to jump off the pulley.  I found it much easier to mount the pulley when the spring is wound tighter around it.

I hope this trick will help you if you need to replace the starter string on your Ryobi trimmer.

Upgraded Wizard to 6.1

By Scott, March 6, 2008 11:52 AM

The Faria ROM I have been using for awhile started having issues recently.  I was having to soft reset more often (sometimes a couple of times per day), and I couldn’t turn on WiFi anymore.  Memory would start at about 21MB and slowly work its way down, though a lot of that is probably due to the applications installed.

So I figured it was time to either reflash with the Faria ROM or use another.  I settled on another, discussed here at XDA Developers.  This is a 6.1 ROM, which is nice because of some of the improvements, such as native threaded SMS.  I also have more memory after a reset: about 24MB versus 21MB with Faria.  Usage feels much snappier, too.  I thought that it might simply be because OMAPClock is included, but when I checked it I was still running at 180MHz.  So if it feels snappy now, I can’t wait to try it at 252MHz, which is what I normally run at.

HTC Wizard with WinMo 6.1

Convert a mailbox GUID to the user and display name

By Scott, February 26, 2008 1:39 PM

If certain MAPI limits are reached when working with sessions, items, attachments, etc., Exchange will deny further access to that user to that object type.  When this happens event ID 9646 is logged in the Application log.  The description of the event contains a mailbox GUID that is causing the issue, but the GUID alone does nothing to indicate what user/mailbox is affected.

Microsoft KB 899663 instructs how to manually transpose GUID into a format that can be used in an LDAP filter so that you can search for a match.  Why do all this by hand when a script can do it for you?  I took an existing script I had that already does the transposition and added an AD search to return the matching dn.  The dn is passed to a name translation function that converts the dn to the NT4 format (domain\username) and displays the match with username and display name.

In addition to the VBScript file, I have also included a compiled version that uses SAPIEN Script Host as the engine.  This is a self-contained, runs-in-memory-only, no-DOS-box-comes-up engine from PrimalScript.  Running the compiled version is nice since you don’t have to ensure that CScript is the default host and no DOS box appears while the script is running.

The zip file with both versions is available here .

Panorama Theme by Themocracy