Migrate from Spaceguard to FSRM

For years a company called Tools4Ever have been producing the excellent Spaceguard, providing flexible quota management for network shares. With the release of Windows Server 2008 R2 Microsoft introduced FSRM (File Server Resource Monitor), providing almost identical functionality out the box.

One of the time consuming aspects of switching to the Microsoft solution can be transferring existing quotas from Spaceguard to FSRM. Thankfully Spaceguard have an option to export the configuration, which we can parse with Powershell and create the shares.

Assuming you’ve already setup a template in FSRM and the folder structure has been migrated, the below Powershell script will read a Spaceguard export (in ASCII CSV format) and make any adjustments to the quotas so that they are identical to what was configured in Spaceguard.

# Displays a select file dialog box, returning the path to a CSV file.
function chooseCSVfile
	param([string]$Title,[string]$Directory,[string]$Filter="CSV Files (*.csv)|*.csv")
	[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
	$openFileDialog = New-Object System.Windows.Forms.OpenFileDialog
	$openFileDialog.InitialDirectory = $Directory
	$openFileDialog.Filter = $Filter
	$openFileDialog.Title = $Title
	$openFileDialog.ShowHelp = $true

	$Show = $openFileDialog.ShowDialog()

	If ($Show -eq "OK")
		Return $openFileDialog.FileName

$FileName = chooseCSVfile -Title "Import a CSV file" -Directory "c:\"
$QuotaInformation = Import-Csv $FileName -Header "CurrentSize","Directory","Account","Quota","Limit"
$QuotaInformation | ft
Foreach ($Quota in $QuotaInformation)
	$quotaPath = $Quota.Directory
	$quotaMB = [int]($Quota.Limit)
	$quotaMB = "$($quotaMB)mb"

	Start-Process dirquota -Verb runAs -WindowStyle Hidden -ArgumentList "quota modify /Path:$quotaPath /Limit:$quotaMB" 

I’d recommend running this script to restore the quotas only once the user data has been migrated. DIRQUOTA has been used in the script to allow for Windows 2008R2 which does not have the Get-FSRMQuota cmdlets.

Published by

Dave Hope

Dave works in IT for a leading UK based retirement developer, in his spare time he enjoys tinkering with technology and rock climbing.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.