function CreateQuota($computer, $path, $size)
{
	Write-Host ($MSG_HARD_QUOTA_CREATING -f $path,$size);
	$result = dirquota quota add /Path:$path /limit:$size /overwrite /remote:$computer;
	if($LASTEXITCODE -eq 0)
	{
		Write-Host ($MSG_HARD_QUOTA_CREATED -f $path,$size);
	}
	else
	{
		$exception = New-Object -TypeName "System.Exception" -ArgumentList $result[2];#($MSG_CREATE_HARD_QUOTA_FAILED -f $path,$size)
		throw $exception;
	}
	Write-Host $result;
}

function CreateSoftQuotaWithCommand($computer, $path, $size, $workingDirPath, $command, $argsstr)
{
	Write-Host ($MSG_SOFT_QUOTA_CREATING -f $path,$size);
	$tempDir = $env:temp;
	$fileName = [guid]::NewGuid();
	$pathToConfig = "$tempDir\$fileName";

	$notification = "Notification=c";
	$command = "Command=$command";
	$arguments = "Arguments=$argsstr";
	$monitorCommand = "MonitorCommand=Enable";
	$workingDirectory = "WorkingDirectory=$workingDirPath";
	$account = "Account=LocalSystem";
	
	$notification | Set-Content $pathToConfig;
	$command | Add-Content $pathToConfig;
	$arguments | Add-Content $pathToConfig;
	$monitorCommand | Add-Content $pathToConfig;
	$workingDirectory | Add-Content $pathToConfig;
	$account | Add-Content $pathToConfig;
	
	Write-Host $pathToConfig;
	Write-Host $command;
	
	$result = dirquota quota add /Path:$path /limit:$size /add-threshold:100 /type:Soft "/add-notification:100,C,$pathToConfig" /overwrite /remote:$computer;

	Remove-Item $pathToConfig;
	
	if($LASTEXITCODE -eq 0)
	{
		Write-Host ($MSG_SOFT_QUOTA_CREATED -f $path,$size);
	}
	else
	{
		$exception = New-Object -TypeName "System.Exception" -ArgumentList $result[2]; #($MSG_CREATE_SOFT_QUOTA_FAILED -f $path,$size)
		throw $exception;
	}
	Write-Host $result;
}