How to serialize/deserialize a nullable date

The time will come when you are serializing and deserializing object to and from XML that you will come across nullable dates, or more correctly an attribute XML date that is nullable.  If you are like me and using the System.Xml.Serialization namespace, which make the complete process of serializing and deserializing so much easier.

Here is the issue, the code below is a nullable datetime, which is fine in .NET

[code language=c#]

 

        private DateTime? dob;
        [XmlAttribute]
        public DateTime? DOB
        {
            get
            {
                return dob;
            }
            set
            {
                dob = value;
            }
        }
[/code]

When you come the serialize/deserialize you find you get an error of:

System.InvalidOperationException: Cannot serialize member ‘DOB’ of type System.Nullable`1[System.DateTime]. XmlAttribute/XmlText cannot be used to encode complex types.

So to over come this you have a number of options, the one I have come up with is to pull the date in using a string and then pre-process the date and then store it in to the nullable date field, like this:

[code language=c#]

 

        private DateTime? dob;
        [XmlIgnore]
        public DateTime? DOB
        {
            get
            {
                return dob;
            }
            set
            {
                dob = value;
            }
        }

        [XmlAttribute(“DOB”)]
        public string DoBstring
        {
            get { 
                return DOB.HasValue
                ? XmlConvert.ToString(DOB.Value, XmlDateTimeSerializationMode.Unspecified)
                : string.Empty;
            }
            set { 
                DOB = 
                !string.IsNullOrEmpty(value)
                ? XmlConvert.ToDateTime(value, XmlDateTimeSerializationMode.Unspecified)
                : (DateTime?) null;
            }
        }
[/code]

You notice that the nullable Date field is not decorated with an XmlIgnore attribute, and the string is picking up the DOB attribute tag

 

 

Running Gallio tests using MSBuild

When using a Continuous Integration server such as TeamCity, you’ll need to be able to perform the ability to run tests, the easiest and most controlled way is by writing your own MSBuild Script.

Here is a little build script that finds all the test files and then runs them using Gallio, of course you need to reference the Gallio MSBuildTasks, in my case they are in C:\Program Files\Gallio\bin\Gallio.MsBuildTasks.dll

[code language=XML]

       <!– Finds test DLL’s –>

      <CreateItem Include=”$(ProjectDirectory)/**/bin/debug/*.Test.dll”>
        <Output TaskParameter=”Include” ItemName=”TestFiles”/>
      </CreateItem>

      <!– Runs Tests –>

      <Gallio IgnoreFailures=”true” Files=”@(TestFiles)”>
        <Output TaskParameter=”ExitCode” PropertyName=”ExitCode” />
      </Gallio>

      <Error Text=”Tests execution failed” Condition=” ‘$(ExitCode)’ != 0 And ‘@(TestFiles)’ != ” ” />

[/code]

BuildAndTest.msbuild (3.32 kb)

How does Home Server take those backups?

I’ve been using Home Server to take backups of all my machines on my network, and I am very pleased, it’s an install and forget service, which is nice for a change from Microsoft.  Until I had to upgrade my server and install two new hard drives.  I found my old backups were no longer available, this would not have been an issue until you need some information held on an old backup, which my Son did.  So after many hours of trying I finally found a document that explains the complete process

Windows_Home_Server_Technical_Brief_-_Home_Computer_Backup_and_Restore.docx (999.09 kb)

Contents

Home Computer Backup Overview……………………………………………………………………….. 4

Features and Functionality……………………………………………………………………………….. 4

Benefits……………………………………………………………………………………………………. 5

Backup and Restore In Depth………………………………………………………………………………. 6

Windows Home Server Console………………………………………………………………………… 6

How Backup Is Implemented………………………………………………………………………………. 9

How Backups Are Stored………………………………………………………………………………. 12

Restoring Individual Files and Folders…………………………………………………………………. 14

Restoring a Home Computer…………………………………………………………………………… 16

Backup Settings and Backup Cleanup………………………………………………………………… 19

Additional Tips…………………………………………………………………………………………… 22

Backup service is not running……………………………………………………………………….. 22

Saving a Copy of the Backup Database……………………………………………………………. 23

Deleting the Backup Database………………………………………………………………………. 24

Restoring a Backup Database………………………………………………………………………. 25

More Information…………………………………………………………………………………………… 26


 

Windows® Home Server will automatically backup your home computers to the home server and allow you to easily restore the entire computer or an individual file or folder to a previous point in time. The Windows Home Server Backup solution backs up only the data that has not already been backed up. Even if you have several copies of the same data on different computers, the data is backed up only once on your home server and your home server keeps track of what data was stored on each home computer on each day. This makes it efficient in the time it takes for backups to complete and the amount of space that is used on your home server.

Features and Functionality

The core features of Windows Home Server Home Computer Backup and Restore are:

 

·    Performs Automated Daily Backup of your Home Computers

      Computer backups are automatically configured when you install the Windows Home Server Connector software on your home computers. Backup is performed on a daily basis for every configured computer.   You can connect 10 computers at one time to Windows Home Server.

 

·      Restores an Entire Home Computer

      If you want to restore your computer to a previous point in time, you restart the home computer from the Home Computer Restore CD. The computer connects to your home server and provides a wizard to follow for restoring a single hard drive or multiple hard drives from the backup of that computer that is stored on your home server.

 

·      Restores Individual Files and Folders

      You can also restore individual files or folders by selecting a specific backup of a home computer from the Windows Home Server Console application. Windows Explorer displays a window with the files and folders that were backed up for that computer on that day. You can drag individual files or entire folders from this window to your Windows Desktop or another location on your home computer.

 

Benefits

Windows Home Server Home Computer Backup is unique compared to other solutions. Some of the benefits are:

 

·      Peace of Mind

Imagine the peace of mind that comes from automatic daily backups. Windows Home Server helps keep your family’s important files safe, backing up every computer in your home, every day.

 

·      Simple to Restore an Entire Computer

You can restore a home computer to a previous point in time by using the Home Computer Restore CD and answering a few questions.

 

·      Saves Disk Space on Your Home Server

When your home server has a copy of a given piece of data, it keeps track of which home computer had that data on which day. The data is only stored once on the home server.

 

·      Saves Time

When your home server has a copy of a given piece of data, it does not have to be copied to the server again even if the data is on another home computer. After you initially back up your first personal computer, subsequent backups take less time to complete. In a home network, there are many duplicate files on your home computers, especially the files belonging to the operating systems and applications that are installed on every computer.


This section of the technical brief explains how Windows Home Server Home Computer Backup and Restore works.

Windows Home Server Console

The Windows Home Server Console provides you with the ability to see which home computers have been configured to be backed up and the backup status of each of your home computers. After you install Windows Home Server Connector on each of your home computers, they are automatically backed up each night to your home server.

 

The options on the Computers & Backup tab allow you to:

·        View Backups   Browse the existing backups of a home computer.

·        Backup Now   Initiate a manual backup of a home computer.

·        Configure Backup   Change the backup settings of a home computer.

·       
Remove Computer   Delete computer and backups from the home server.  

     Figure 1:   Windows Home Server Computers & Backup tab


Configuring Backups

If you add or remove hard drives from your home computers, you need to use the Configure Backup option from the Windows Home Server Console to inform your home server of the new hard-drive configuration on the home computer.

 

You can also use the Configure Backup option to exclude certain folders from being backed up from a home computer to a home server. By default, Windows Home Server avoids backing up certain files and folders each day. This list includes:

 

·        User temporary files

·        System page file

·        Hibernation file

·        Client-side cache folders

·        Shadow volume implementation folders

·        Media Center temporary files

 

  Caution

To save space in the backup database on your home server, recorded TV shows on Windows Media Center are not backed up from a home computer to your home server. If you want to have a backup copy of your recorded TV shows, one option is to copy the Recorded TV folder from your computer running Windows Media Center to a shared folder on your home server.

You can temporarily turn off backups for one or more of your home computers. You may want to do this for a computer that will be out of your home for a week or more or for a home computer that you no longer use but you want to keep a backup image.

 

*      To turn on or turn off backups

  1. Open the Windows Home Server Console.
  2. Click the Computers & Backup tab.
  3. Right-click a computer, and then select  Turn Off Backups or Turn On Backups

Daily automatic backups do not occur on a computer if you turn off backups. However, you can manually back up the computer if you right-click it in the Windows Home Server Console, and then click Backup Now.

Removing Computers

If you no longer want to save the backups for a home computer, you can remove that computer from the Windows Home Server Console, by using the Remove Computer option. 

If possible, uninstall the Windows Home Server Connector software from the computer before you remove the computer from the console. If your computer is still on you will be required to do this.  If you cannot remove the Windows Home Server Connector software because the computer is no longer available, you can still safely remove the computer from the console.

 

*      To remove a computer from the console

  1. Open the Windows Home Server Console.
  2. Click the Computers & Backup tab.
  3. Right-click a computer, and then click Remove.

Caution

All existing backups for a home computer are deleted from the home server if you remove the home computer from the console.


 

When you install the Windows Home Server Connector software on your home computers, they are configured to automatically back up every day during the backup time that you choose. Your computers must be turned on or they must be in sleep or hibernate mode to be automatically backed up. If a computer is in sleep or hibernate mode, it wakes up, runs Backup, and then goes back in to sleep or hibernate mode.

 

Important

Laptops and other battery-powered computers must be plugged in to AC power to be automatically backed up. Although the home computer on battery power will be awakened, Windows Home Server will recognize it as battery-powered and automatic backup will not initiate. On home computers running Windows XP, there is no easy way to tell whether the computer was awakened from sleep or hibernate, so the computer is put back to sleep when the backup process completes.  You can also disable this functionality by un-checking the “Wake This Computer For Backup” item by right clicking the Windows Home Server Connector in the system tray.

 

You should back up all of the hard drives on each home computer including the system volume (typically, drive C:). If the hard drive that contains the system volume fails, you can restore it by using the Home Computer Restore CD and restarting the computer. You should also back up any volume that contains valuable or important files that you do not want to lose. For example, you may have irreplaceable pictures or videos, which you can back up to protect them from a hard drive failure.

 

Important

Windows Home Server backs up only the NTFS file system volumes. If the volume on a home computer was created as a FAT or FAT32 volume, it is not displayed in the list of volumes to back up.  Changing the existing file system on a hard disk volume from FAT or FAT32 to NTFS can be time consuming, but after the system is converted to NTFS, Windows Home Server can back it up. If you decide to upgrade your file system to NTFS, you should back up your data by copying it to an external hard drive and then reformat the volume using NTFS.

Note

You can use the Convert.Exe program to change a hard disk volume from FAT or FAT32 to an NTFS volume without formatting the volume. If you use the Convert.Exe program, your NTFS file system will be formatted with 512 byte clusters, thereby reducing the efficiency of the Windows Home Server backup database.

 

The home computer backup solution in Windows Home Server has a single-instance store at the cluster level. Clusters are typically collections of data stored on the hard drive, 4 kilobytes (KB) in size. Every backup is a full backup, but the home server only stores each unique cluster once. This creates the restore-time convenience of full backups (you do not have to repeat history) with the backup time performance of incremental backups.

 

The home computer backup occurs as follows:

·        When a home computer is backed up to the home server, Windows Home Server software figures out what clusters have changed since the last backup.

·        The home computer software then calculates a hash for each of these clusters and sends the hashes to the home server. A hash is a number that uniquely identifies a cluster based on its contents.

·        The home server looks into its database of clusters to see if they are already stored on the home server.

·        If they are not stored on the home server already, then the home server asks the home computer to send them.

·        All file system information is preserved such that a hard disk volume (from any home computer) at any backup point (time) can be reconstituted from the database.

 

 


Figure 2:  Windows Home Server backup solution stores unique data once

 

The copies of the clusters that are stored on the home server in the order they are received. Additionally, the home server stores metadata files which allow it to deduce which clusters belong to which home computer at which times. The metadata that is typically stored for each home computer usually takes less than 5 percent of the space of the clusters that are backed up.

 

Some of the implications of this backup approach are:

 

·        The first backup always needs to send the entire contents of the disk to the home server.

·        The first backup of a different home computer needs to read all of its data but only transmit the content of those clusters that the home server does not already have from another home computer.

·        Subsequent backups after little change typically only read a small amount of data on the home computer and send the new clusters to the home server.

·        After you defragment a home computer, the next backup may need to read a large amount of data from the disk (many files will appear to have been changed), but it only sends a relatively small amount of data to the home server because the clusters have been reorganized, but they have not changed.

 

Note

The first backup should be of the home computer with the largest hard drive that is connected through a wired Ethernet connection, because the first backup of a home computer to your home server sends the entire contents of the disk to the home server over your home network.

 

 


How Backups Are Stored

The home server side of the solution is a database that is specifically designed to efficiently backup multiple home computers on a daily basis. The cluster data and metadata from each home computer is stored on the home server hard drives.

 

The backup database is stored entirely in the folder D:\folders\{00008086-058D-4C89-AB57-A7F909A47AB4}\. The content of this folder is migrated by Windows Home Server Drive Extender from the primary data partition to a secondary data partition if the home server has more than one hard drive.

 

The Windows Home Server backup engine stores data at the cluster level. Clusters are typically 4 kilobytes (KB) in size. The backup database records include clusters and hashes of these clusters (a hash is a number that uniquely identifies a cluster based on its contents). The database also contains information on the structure of a hard disk volume (NTFS information).

 

During the backup process, a cluster from one home computer that is identical to a cluster from a different home computer is sent to the server exactly once and stored exactly once. Because Windows Home Server backs up multiple computers (space) every day (time) to a single database, it in essence supports “single instancing of home computer backups across space and time.”

 

When the cluster size is different among volumes, no data is shared between the volumes in the backup database. By default, every newly created NTFS volume gets a cluster size of 4 KB. A few volumes that started out as FAT and were converted to NTFS have a cluster size of 512 KB. The only way to get any other cluster size is to format the volume yourself and explicitly request a different size.

 

Note

You can maximize the efficiency of the home server backup database by ensuring that all of the hard drives on your home computers are formatted with NTFS and with a cluster size of 4 KB.

 


The backup database is a collection of files that can be broken into three categories:

 

·        Global files – Files that track the history of all home computer backups and all of the other files in the backup database.

 

·        Cluster files – Files that store the actual cluster data from the home computers. These are usually in 4096 byte increments. These files grow to 4 GB in size before a new file is created. These files are stored as Data.XXXX.Z.dat, where XXXX=cluster size in bytes, and Z=0,1,2,…

 

·        Home Computer specific files – A boot record and data for each hard drive volume that gets backed up from each home computer.


 

Restoring Individual Files and Folders

To restore individual items from a previous backup stored on the home server, a virtual volume driver is loaded on the home computer. This allows a previous image of a hard drive to be mounted, as if it were a read-only volume, across the home network. This driver opens a connection to the home server, and it receives the relevant clusters from the home server to build a virtual view into what a given hard drive looked like on a given day. The read-only volume is displayed in Windows Explorer where a user can drag the files and folders that they want to restore to the Windows Desktop of the home computer they are using.

 

Important

A home computer that is behind your home firewall and has the Windows Home Server Connector software installed can create a backup without further authorization or authentication. However, restoring individual files and folders and restoring home computers using the Home Computer Restore CD requires the Windows Home Server password.

 

*      To browse and restore individual files and folders from a backup

1.      Open the Windows Home Server Console.

2.      Click the Computers & Backup tab.

3.      Select a home computer, and then click View Backups.

4.      Select a backup, and then click Open.

5.      Select a volume to open, and then click Open.

Important

The Opening Backup status window appears while the backup opens. If you are prompted to restart your computer after the virtual volume driver is installed, ignore this message; you do not need to restart your computer.


               Figure 3:  Status window to ignore when you restore files and folders

 

*      To restore files and folders

  1. When the backup library window opens, drag the backup files and folders that you want to restore to a folder on your home computer.
  2. Close the window when you are done copying the files and folders that you want to restore.


                 Figure 4:  Home computer backup for a specific date


 

Restoring a Home Computer

After backups for a home computer are stored on the home server, you can use the Home Computer Restore CD to restore the entire content of one or more home computer hard drives to a previous point in time.


          Figure 5:  Windows Home Server Restore Computer Wizard

 

The system volume of a home computer contains the hardware-specific files that you need to start your Microsoft® Windows operating system. This is usually the C: drive. If this volume is damaged, you will not be able to start your home computer, and you need to start your computer from your Home Computer Restore CD.

 

*      To restore a hard drive volume of a home computer

  1. Place the Home Computer Restore CD in the optical drive of the home computer for which you want to restore one or more hard drive volumes.
  2. Restart the computer, and boot from the CD.
  3. Follow the instructions in the Restore Computer Wizard to restore the hard drives on your home computer.

Important

Your home computer must be connected to the home network with an Ethernet network cable before you begin the restore. In most cases, you cannot use a wireless connection, and attempting to use a wireless connection is an unsupported scenario.

 

Every time Windows Home Server backs up a home computer, it saves the drivers for the home computer in the backup that is stored on the home server. When you use the Home Computer Restore CD, you will be prompted if your home computer requires drivers that are not available on the Home Computer Restore CD.  If you need to access the drivers for any of your home computers (for example, during a computer restore), you can open a backup for that home computer and copy the drivers to a USB flash drive.

 

 

*      To copy drivers for a home computer from a backup stored on the home server

  1. Open the Windows Home Server Console.
  2. On the Computers & Backup tab, click the computer that you need drivers for.
  3. Click View Backups.
  4. Select the most recent backup, and then click Open.
  5. Select a volume to open (any volume will work), and then click Open. A window opens showing the files and folders in the backup.
  6. Plug in your USB flash drive.
  7. Copy the Windows Home Server Drivers for Restore folder from the open window to your USB flash drive.
  8. Remove the flash drive, and then insert it into the home computer that is being restored.


       Figure 6:  Home computer drivers to use for Home Computer Restore

You can use the USB flash drive to install drivers for your home computer’s specific hardware when you restore the home computer. The Home Computer Restore CD looks for additional drivers on a USB flash drive as part of the initial boot process. The drivers you are most likely to need during a home computer restore are the network driver and the storage-device driver.

 

Important

If you are restoring from a 64-bit computer the drivers that are stored in the backup will be 64-bit.  These will not function with the 32-bit restore CD.  Therefore it is may be necessary to obtain 32-bit versions of the network driver and storage-device drivers for your 64-bit computer, while doing a restore of your home computer.


Backup Settings and Backup Cleanup


There are a few settings that you can configure for Windows Home Server Backup from the Windows Home Server Console. The Backup Time defines what hours during each day that backup processes will run, and the Automatic Backup Management settings define a retention policy for the home computer backups.

     Figure 7:  Backup settings

 

If you have multiple home computers, they back up sequentially. Therefore, backups can potentially happen during the entire backup window. If a backup is still in progress when the backup time ends, it finishes but no new backups can start. Any computer that has not yet started its backup tries again during the next backup time. The Backup Time setting is limited so that your computers are not busy backing up when you want to use them.

 

Note

In general, the Backup Time should be set for a time when people in your household will not be using the home computers. The longer the time period, the more likely it is that all of your home computers will be backed up each day.

 


Home computers initiate the backup process as a hidden scheduled task. The home computers randomly select a time each day during the Backup Time to initiate their daily backup to the home server, and they alternate which computer will back up first on a given day. Only one home computer can back up at a time, so if another computer tries to start a backup to the home server, it will wait until the first computer’s backup completes.

 

Daily backups of all your home computers accumulate on your home server over time. To help you manage these backups, Windows Home Server provides Automatic Backup Management. With Automatic Backup Management, you can configure how many backups to keep for each of your home computers. To configure how many backups to keep, set the number of months to keep the first backup of the month, the number of weeks to keep the first backup of the week, and the number of days to keep the first backup of the day.

 

If you click View Backups from the Windows Home Server Console, you can see the three options for each home computer backup:

 

·        Manage automatically (processed as part of Backup Cleanup)

·       
Keep the backup (kept until users decides to change this option)

·        Delete at next Backup Cleanup

     Figure 8:  Available backups for NEW-LAPTOP home computer


Important

Home computer backups that are manually initiated by using the Backup Now option are marked with the Keep this backup option, until someone explicitly changes them from the Windows Home Server Console.

 

Backup Cleanup runs once a week at the beginning of the Backup Time on Sunday. It has two purposes: 

  1. Delete the metadata about home computer backups that are no longer needed
  2. Delete copies of clusters that are no longer referenced by any home computer backup.

 

Deleting the metadata is relatively fast (typically a few minutes per home computer), but it does not recover much space because the metadata for each home computer backup is usually less than five percent of all of the space consumed by the backup database. Deleting copies of clusters rarely recovers much space because the backup database is a single instance store of the unique clusters stored on your home computers. If another home computer backup that references a given cluster still exists, then the cluster will continue to be stored in the backup database.

 

Important

If you temporarily stop the backup of a home computer, Windows Home Server continues to apply the Automatic Backup Management settings for your home computer backups. For example, assume your Automatic Backup Management settings are set for 3 days, 3 weeks, and 3 months. If you stop backing up a home computer, your home server will continue to keep the last three daily backups, weekly backups, and monthly backups, if they exist.

 

If you remove a computer from the Windows Home Server Console, all of the backups for that home computer will be deleted during the next Backup Cleanup. This is when you will see the largest decrease in the size of the backup database, especially if the home computer had a lot of unique data.

 

Note

Windows Home Server checks for Windows Updates at the beginning of the Backup Time. Depending on the requirements of the updates, your Windows Home Server may restart during this time.

 

Additional Tips

Following are a few additional tips and techniques for situations that you may encounter or you may want to experiment with in Windows Home Server Backup and Restore.

Backup service is not running

You may see the following error: “If backup service is not running, please restart the console.”  If you see this error, try resetting the console before connecting to Windows Home Server.

 

*      To reset the Windows Home Server Console

1.      Right-click the Windows Home Server icon in the taskbar, and then click Windows Home Server Console.

2.      On the console Password page, click Options.

3.      Click Reset the Windows Home Server Console.

4.      Click OK.


 

Caution

Ensure that Backup Cleanup is not running and that none of the home computers are being backed up during the following tasks: Saving a Copy, Deleting, and Restoring the Backup Database.  

Saving a Copy of the Backup Database

The Windows Home Server backup database is not duplicated by Windows Home Server Drive Extender. So if you lose a single hard drive on your home server, you could possibly lose all of the backups of your home computers.

 

You may want to periodically copy the entire backup database from your home server to an external hard disk that you attach to your home server. The external hard disk should not be added to the Server Storage on your Windows Home Server.

 

Important

The cluster data files stored in backup database can grow to 4 GB, so it is important that the external hard disk is formatted as NTFS to support copying these large files. Some file systems, such as FAT-32 allow a maximum file size of 2 GB.

 

The backup database is stored entirely in the folder D:\folders\{00008086-058D-4C89-AB57-A7F909A47AB4}.

 

*      To copy the backup database from your Windows Home Server

(In this example, assume that the external hard drive is given a drive letter of E:)

 

1.      Run mstsc.exe to start a Remote Desktop Connection session to your home server.

Caution

Be careful when using a Remote Desktop Connection to your home server. You can damage Windows Home Server functionality if you use it incorrectly.

 

2.      Plug in an external hard drive to your home server (do not add it to the Server Storage through the Windows Home Server Console).

3.      Open a Command Prompt, Click Start, Run and type CMD

4.      Type net stop PDL.

5.      Type net stop WHSBackup to stop the Windows Home Server Backup service.

6.      Copy the contents of D:\folders\{00008086-058D-4C89-AB57-A7F909A47AB4} to the external hard drive E:.

7.      Type net start WHSBackup to restart the Windows Home Server Backup service.

8.      Type net start PDL.

The only relevant settings that Windows Home Server backup stores in the registry on the home server are Backup Time and Automatic Backup Management.

Deleting the Backup Database

You may want to delete the entire backup database from your home server to reclaim the disk space. The backup database is stored entirely in the folder D:\folders\{00008086-058D-4C89-AB57-A7F909A47AB4}.

 

*      To delete the backup database on your Windows Home Server

 

1.      Run mstsc.exe to start a Remote Desktop Connection session to your home server.

 

2.      Open a Command Prompt, Click Start, Run and type CMD

3.      Type net stop PDL.

4.      Type net stop WHSBackup to stop the Windows Home Server Backup service.

5.      Delete the contents of D:\folders\{00008086-058D-4C89-AB57-A7F909A47AB4}.  Do not delete the folder.

6.      Type net start WHSBackup to restart the Windows Home Server Backup service.

7.      Type net start PDL.

 

Important

After deleting the backup database, you need to reinstall the Windows Home Server Connector software or run the Discovery.Exe program on each of your home computers to re-establish a relationship between your home computers and your home server so new backups will occur.

Restoring a Backup Database

You may want to restore an entire backup database, which you previously saved on an external hard drive, to your home server. Prior to restoring a backup database, you need to delete the existing backup database from the home server. Currently, there is not an option to merge backup databases into a single database.  

 

*      To restore the backup database to your Windows Home Server

(In this example, assume that the external hard drive is given a drive letter of E:, and it has a copy of a home server backup database that was previously saved as described in the Saving a Copy of the Backup Database section earlier in this document.)

1.      Run mstsc.exe to start a Remote Desktop Connection session to your home server.

 

2.      Plug in an external hard drive to your home server (do not add it to the Server Storage through the Windows Home Server Console).

3.      Open a Command Prompt, Click Start, Run and type CMD.

4.      Type net stop PDL.

5.      Type net stop WHSBackup to stop the Windows Home Server Backup service.

6.      Delete the contents of D:\folders\{00008086-058D-4C89-AB57-A7F909A47AB4}.  Do not delete the folder.

7.      Copy the contents from the external hard drive E:\folders\{00008086-058D-4C89-AB57-A7F909A47AB4} to D:\folders\{00008086-058D-4C89-AB57-A7F909A47AB4}.

8.      Type net start WHSBackup to restart the Windows Home Server Backup service.

9.      Type net start PDL.

For more information about Windows Home Server, see the Microsoft Web site (http://go.microsoft.com/fwlink/?LinkId=100260).

 

For more information about Windows Home Server Home Computer Backup and Restore, see the Community Forums at the Microsoft Web site (http://go.microsoft.com/fwlink/?LinkId=100263).

 

How to get MEF to load all Assemblies in a directory

The nice thing about MEF is the ability to dynamically load additional modules in to an application with very little effort.

To make it even easier, I’ve generated a small MEF Compose which will load up all DLL in a directory automatically.

[code language=C#]

private void Compose()
        {
            var catalog = new AggregateCatalog(
                new AssemblyCatalog(System.Reflection.Assembly.GetExecutingAssembly()),
                new DirectoryCatalog(@”.\Extensions”));
            var container = new CompositionContainer(catalog);
            container.ComposeParts(this);
        }

[/code]

The above code works well for .NET, however for some reason .NET 3.5 version, which is available from CodePlex just comes back with nulls, so here is a solution for MEF for .NET 3.5

[code language=C#]

private void Compose()
        {
            var key = Assembly.GetExecutingAssembly().GetName().GetPublicKey();
            var catalog = new AggregateCatalog();
            catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));
            var dir = new DirectoryInfo(@”.\Extensions”);
            Assembly assembly;

            foreach (var file in dir.GetFiles(“*.dll”))
            {
                assembly = Assembly.LoadFile(file.FullName);
                byte[] assemblykey = assembly.GetName().GetPublicKey();
                catalog.Catalogs.Add(new AssemblyCatalog(assembly));
            }

            var container = new CompositionContainer(catalog);
            container.ComposeParts(this);
        }
[/code]