Skip to main content

Steve Walker's SharePointing Blog

Go Search
Steve Walker's SharePointing Blog
  

Steve Walker's SharePointing Blog > Categories
Dual Boot your Windows 7 Machine into another OS using a VHD
I wanted to be able to run Windows Server 2008 R2 on my laptop so that I could do development that requires this OS but I did not want to loose all of the coolness of Windows 7 (Hibernate, sleep, etc...)
 
I also did not have enough space once I shrunk my primary partition to install the OS in the typical Dual Boot fashion... I was getting ready to wipe my machine and reformat/repartion my machine so that I could Dual Boot in the traditional manner but then I thought... Why not try to use the new feature of Windows 7 and Server 2008 that allows you to boot from a VHD. Once I had gone through it, I realized just how easy this is !!!
 
Here are a couple of articles that i used to get me started:
 

http://edge.technet.com/Media/Windows-7-Boot-from-VHD/

http://blogs.technet.com/keithcombs/archive/2009/05/22/dual-boot-from-vhd-using-windows-7-and-windows-server-2008-r2.aspx

 

 

The basic steps are to:

Boot from your Server 2008 R2 DVD

Click next on the Language Screen

SHIFT+F10

DISKPART

 

Once you are in DISKPART, you use the following commands to create the VHD and format it

  1. LIST VOL
  2. CREATE VDISK FILE=c:\windows7rc.vhd MAXIMUM=200000 TYPE=EXPANDABLE
  3. SELECT VDISK FILE=c:\windows7rc.vhd
  4. ATTACH VDISK
  5. CRE PART PRI
  6. FORMAT FS=NTFS QUICK
  7. ASSIGN LETTER=V:
  8. LIST VOL
  9. LIST VDISK
  10. exit DISKPART
  11. exit WinPE command console

You are now returned to the installer

 

Complete your installation and then when you boot your machine, you will have the option to boot to Win7 OR server 2008.

 

You have the benefit of using a VHD for your disk, you can implement disk differencing, etc… but you are still running “On the Metal” rather than running virtually within another host OS. This provides all of the advantages of running straight on your hardware.

 

For SharePoint Development, this is a HUGE win :-)

 

Hope someone finds it helpful,

 

Happy SharePointing !!!

List Instances with Data Defined - Duplicating List Items
For anyone that has had this problem, hopefully this helps. I have written code in a previous project to repair this but then on my current project, found an Out of the Box Solution (No Code)
 
So here is the scenario. You have a feature that activates a list instance. In this List Instance, you are defining some data rows that you want to be populated into the list when it is provisioned. Typically, this would look something like this:
 
 <ListInstance
    FeatureId="{AD72BD0A-B2B6-4932-B4EC-D101B20E2E04}"
    TemplateType="10001"
    Title="$Resources:customerwcm,NavLinksList_Title;"
    Url="Lists/NavLinksList"
    Description="$Resources:customerwcm,NavLinksList_Description;">
  <Data>
   <Rows>
    <Row>
     <Field Name="Key">HomeLink</Field>
     <Field Name="Title">$Resources:customerwcm,NavLinksList_Home;</Field>
     <Field Name="Location">topnav</Field>
     <Field Name="DisplayOrder">0</Field>
     <Field Name="URL">/</Field>
    </Row>
    <Row>
     <Field Name="Key">ContactUsLink</Field>
     <Field Name="Title">$Resources:customerwcm,NavLinksList_ContactUs;</Field>
     <Field Name="Location">subtopnav</Field>
     <Field Name="DisplayOrder">2</Field>
     <Field Name="URL">/$Resources:cmscore,List_Pages_UrlName;/contactus.aspx</Field>
    </Row>
   </Rows>
  </Data>
 </ListInstance>
 
When this feature is activated, the List instance is created and the two list items are added. So what's the problem ? If you activate the feature again (through feature de-activate and then re-activate) OR through Content Deployment (Features are activated again on the target farm) then your list items will be duplicated. You will end up with TWO of each of these items. De-activate and re-activate again and you will have 3 items of each. This is not only annoying but can cause problems in lists that you use for configuration settings, etc.
 
Previously, I wrote a serious amount of code to work around this issue (which I will not go into detail here) but recently discovered a very simple fix. Add an ID to each of the list items and define the ID for each item. so the previous List Instance element XML would look like this:
 
 <ListInstance
    FeatureId="{AD72BD0A-B2B6-4932-B4EC-D101B20E2E04}"
    TemplateType="10001"
    Title="$Resources:customerwcm,NavLinksList_Title;"
    Url="Lists/NavLinksList"
    Description="$Resources:customerwcm,NavLinksList_Description;">
  <Data>
   <Rows>
    <Row>
     <Field Name="ID">1</Field>
     <Field Name="Key">HomeLink</Field>
     <Field Name="Title">$Resources:customerwcm,NavLinksList_Home;</Field>
     <Field Name="Location">topnav</Field>
     <Field Name="DisplayOrder">0</Field>
     <Field Name="URL">/</Field>
    </Row>
    <Row>
     <Field Name="ID">2</Field>
     <Field Name="Key">ContactUsLink</Field>
     <Field Name="Title">$Resources:customerwcm,NavLinksList_ContactUs;</Field>
     <Field Name="Location">subtopnav</Field>
     <Field Name="DisplayOrder">2</Field>
     <Field Name="URL">/$Resources:cmscore,List_Pages_UrlName;/contactus.aspx</Field>
    </Row>
   </Rows>
  </Data>
 </ListInstance>
 
Notice the Extra :      <Field Name="ID">2</Field> node.
 
Apparently, when SharePoint goes to add the items, if there is one already there with that particular list ID, it skips it. I have tested this to ensure that it is not simply overwriting the existing one and it works as desired.
 
I hope this simple tip is as useful to all of you as I found it to be !!
 
Happy SharePointing !!

 Error

Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.

Error Details:
[UnsafeControlException: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.]
  at Microsoft.SharePoint.ApplicationRuntime.SafeControls.GetTypeFromGuid(Guid guid)
  at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts)