Sunday, October 17, 2010

Virtual Box Virtual Images won’t start after upgrading

After a few weeks of vacation and some other projects I started using Virtual Box again. As as usual I needed to update the application. I downloaded the new version (3.2.10), also noticed that it’s now all Oracle stuff. I started my a old virtual machine, however I always failed after a few seconds. Created a new virtual machine and again.

I tracked it down to the Storage section. Normally the VM configuration used the IDE controller. However in the new version I noticed that the virtual hard disk was mounted on the SATA controller.

So by default it looks like it attaches the VHD to the SATA Controller. I changed this back, so the VHD is now mounted on the IDE controller.

This fixed the problem, I can now start the VHD without problems. Probably an existing Windows 2008 VHD doesn’t like switching from IDE to SATA.

Monday, May 10, 2010

Running Hyper-V images with Sun VirtualBox

If you want to run your Hyper-V created or downloaded machines on Sun VirtualBox, you might experience some problems. When settings in VirtualBox are incorrect the image won’t start. I first thought it’s was about conflict with Hyper-V Integration Services or incompatibility between the Hyper-V vhd and VirtualBox. But luckily it’s just some configuration of VirtualBox to make it work.
So I have a SharePoint 2010 Hyper-V image and Next week I need to give a training and needed to use Sun VirtualBox as Hyper-V doesn’t run on Windows XP. So I copied the Hyper-V virtual hard disk to my local machine and followed the following steps.
  • Start VirtualBox
  • Create a new Virtual Machine
  • Do the basic settings
  • Add the Hyper-V virtual hard disk
  • Set IO APIC enabled in the Systems Tab (this is is important, otherwise it will hang after like 20 seconds on startup)

  • Start the VM in VirtualBox
  • Stopped the Hyper-V services and set startup type to: Manual

  • Installed the VBoxGuestAdditions for better integration with the virtual machine.
If you didn’t set the correct settings the virtual machine does start however after about 20 seconds (depending of your hardware) it hangs forever, and looks like this:

Thursday, April 15, 2010

Daily and Weekly SharePoint 2010 Site Collection backup using Powershell

Backup instructions for Site Collection, read TechNet http://technet.microsoft.com/en-us/library/ee748617(office.14).aspx
I want to backup the site collection daily and keep a backup of every week of the year. I created a Powershell script and scheduled the script.

The Powershell script does the following:

  • checks if SharePoint Powershell Snapin is loaded;
  • checks if backup location exists;
  • backups the site collection;
  • copies the daily backup to the weekly if necassary;

The ‘Backup Site Collection.ps1’ code:

"-------------------------------------"
"Yellow & Red SharePoint Backup script"
"-------------------------------------"
"- One daily backup"
"- And weekly backup"
#Backup location
$backupLocation = "\\XXX\d$\_backups\XXX\"
#Site collection location
$sitecollection = "http://XXX"
#daily filename
$dailybackupfile = Join-Path -Path $backupLocation -ChildPath "backup_yarintranet_daily.bak"
#weekly filename (using uformat as format doesn't have week option)
$weeklybackupfile = Join-Path -Path $backupLocation -ChildPath ("backup_yarintranet_" + (Get-Date -UFormat %Y%W) + ".bak")
# check to ensure Microsoft.SharePoint.PowerShell is loaded
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null) {
    Write-Host "Loading SharePoint Powershell Snapin"
    Add-PSSnapin "Microsoft.SharePoint.Powershell"
}
if(!(test-path $backupLocation -PathType Container))
{
    "Backup location (" + $backupLocation + ") not found."
    break
}
"Starting backup process"
Backup-SPSite -Identity $sitecollection -Path $dailybackupfile -Force
"Finshed backup process"
"Copy daily backup to weekly if necessary"
if((test-path $weeklybackupfile -PathType Leaf))
{
    "Weekly backup file found, so no backup will be made"
    break
}
copy $dailybackupfile $weeklybackupfile -Force
"Finished"

 

Schedule the a task using the Windows 2008 scheduler.

image

Make sure that:

  • you set the correct Identity that has access to the backup location;
  • task runs even when user is not logged in;
  • Set interval of script execution in ‘Trigger’ tab;

image 

In ‘Action’ Tab set the execution of the Powershell script:

  • Program/script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
  • Arguments: -file "<full path location to your Site Collection backup Powershell script>" (exclude the <, include the ")

And as always, make sure you test your backup. Otherwise you’ll have a very bad day when disaster strikes.

Wednesday, April 14, 2010

SharePoint 2010 - PDF iFilter comparison

Very interesting results in the PDF iFilter products for SharePoint 2010 (beta). Check out this article. Foxit wins big time.

Thursday, April 8, 2010

Schema.xml, onet.xml and baseview doesn’t pick up scope attribute

Again some strange things with SharePoint 2010 (maybe also with MOSS 2007) when using custom list template and a list view web part. It turns out that not all settings from the schema.xml are used in the web part view.

So I created a list template based on document library, added a custom view like this:

<View BaseViewID="41" Type="HTML" WebPartZoneID="Main" DisplayName="LatestChanges" Scope="Recursive" DefaultView="FALSE" TabularView="FALSE" MobileView="FALSE" MobileDefaultView="FALSE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/dlicon.png" Url="Forms/LastChanges.aspx">
        <XslLink Default="TRUE">main.xsl</XslLink>
        <RowLimit Paged="TRUE">10</RowLimit>
        <Toolbar Type="Standard">
        </Toolbar>
        <ViewFields>
          <FieldRef Name="DocIcon" />
          <FieldRef Name="LinkFilename" />
          <FieldRef Name="Modified" />
          <FieldRef Name="Editor" />
        </ViewFields>
        <Query>
          <OrderBy>
            <FieldRef Name="Modified" Ascending="FALSE" />
          </OrderBy>
        </Query>
        <ParameterBindings>
          <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noitemsinview_doclibrary)" />
          <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noitemsinview_doclibrary_howto2)" />
        </ParameterBindings>
      </View>

The view should display the last 10 modified documents, without showing folders. So I changed the Rowlimit, the Orderby and set Scope attribute to Recursive.

To provision a site with a page, with (my custom) document list I added this line to the onet.xml:

<List FeatureId="f8525c7b-c680-4431-94aa-4bb6e55827b5" Type="10000" Title="$Resources:core,shareddocuments_Title;" Url="$Resources:core,shareddocuments_Folder;" QuickLaunchUrl="$Resources:core,shareddocuments_Folder;/Forms/AllItems.aspx"/>

Make sure the web part is set to the correct view added this line to the onet.xml:

<View List="$Resources:core,shareddocuments_Folder;" BaseViewID="41" WebPartZoneID="TopRow" WebPartOrder="2" />

After depoying, and testing the provisioned page with the web part view is created and it looks like all settings of the BaseViewID, in this case 41, are copied to the view settings of the web part. However it does not copy all settings, the Scope="Recursive" is not copied. It turns out that the Scope="Recursive" should be set on the <View> element in the onet.xml itself. So the onet.xml should have a line like this:

<View List="$Resources:core,shareddocuments_Folder;" BaseViewID="41" Scope="Recursive" WebPartZoneID="TopRow" WebPartOrder="2" />

Now the scope is set correctly and the folders are not shown in the web part.

BTW: I don’t know if this is a bug. However when you change the web part view by hand and select the view ‘LatestChanges’, than it does copy the Scope attribute.