Archive for January, 2009

VMRC Plus un tool per gestire Virtual Server

January 29, 2009

Si tratta di un tool per Virtual Server R2 SP1 che rende molto più semplice e ricca di funzionalità la gestione delle virtual machines. Si può trovare nel Resource Kit di Virtual Server R2 SP1. Potete scaricarlo QUI

Il tool è  stato sviluppato internamente da due colleghi di Microsoft, Paul Despe e successsivamente Matthijs ten Seldam. 

ATTENZIONE: non esiste supporto per questo TOOL.  Leggete l’EULA prima si utilizzarlo. Se invece siete interessati ad uno strumento per gestire a livello enterprise virtual machines create con Virtual Server, vi consiglio caldamente di dare un’occhiata a System Center Virtual Machine Manager.

Un’elenco delle funzionalità introdotte:

  • Direct control of local or remote instances of the Virtual Server service. IIS and IE browser are no longer required!
  • Tabbed interface to quickly jump between Virtual Server hosts and guest VMRC sessions.
  • Reusable saved states: this feature allows users to preserve a particular saved state and return to that state at any time.
  • Multiple guest selection supported for startup/shutdown/save/display.
  • Browse button navigation for media, hard disk images, ISO images, .VMC files, etc.
  • Drag and Drop support for .VMC files, ISOs images, VHD and VFD files.
  • Resizable desktop support for guests running Virtual Machine Additions (maximize VMRC window supported).
  • Limited cut and paste of text from host to guest (only).
  • A built-in utility to take JPG screenshots of running guests. Useful when filing bugs.
  • Built-in error notification with Virtual Server eventlog viewer.
  • A Virtual Networks Manager and Virtual Disks Manager that cover all features.
  • Keyboard shortcuts (e.g. Ctrl-S to save state a guest).
  • Create multiple guests at once.
  • Create guest from parent (or multiple guests)!
  • Automatic reconnect to a designated Virtual Server host.
  • Toolbars in both Guest and Console Manager for quick access.
  • Unlimited number of guests.
  • Maximum of 32 Virtual Server hosts.
  • Sorting on columns of guests so you can sort based on status and multi-select.
  • Automatic detection of Virtual Machine Additions and notification.
  • Detection of Virtual Server 2005 R2 SP1

Sharepoint 2007 creare un menu personalizzato in una raccolta documenti modificando il custom action

January 27, 2009

Vi segnalo il link ad un interessante articolo su come creare un menu personalizzato in una raccolta documenti modificando il custom action in Sharepoint 2007.

SQL Server 2005 Error: User or Role already exists in the current database

January 26, 2009

Just for me to remember. I’m currently doing migration of our applications and databases. This is something that came up when I migrated one of my databases. I certainly would like to remember…

This is what happens when you restore the database to a new server, you expect that accounts could be configured to access the database via the “User Mapping”. But instead there is this error message: “Error 15023: User or role already exists in the current database.” Apparently, this is just a case of SID mismatch. Here’s the solution:

SQL Server has a built in stored procedure to handle this issue:


Use the parameter ‘Update_One’ to update one SID:

USE YourDatabase
EXEC sp_change_users_login Update_One, ‘yourLogin’, ‘yourLogin’

How to change MS SQL Server 2005 server collation

January 25, 2009

The most clear and easy way is to completely reinstall the sql server instance. In SQL server 2000 and earlier versions there is rebuild master utility – rebuildm.exe which has very clear interface but there are many cases when this utility hangs and you lose your master database forever.

Starting from SQL server 2005 rebuild master utility is integrated into installation package. So you need to load your installation drive and run from command line the next command

setup.exe /q /ACTION=RebuildDatabase /INSTANCENAME=MSSQLSERVER



Adjust this params for your needs – INSTANCENAME – put the instance name you want to change collation of. INSTANCENAME=MSSQLSERVER – default instance. SAPWD – new sa password, SqlCollation – new sql server instance collation. This query may be used to rebuild master of SQL server 2005 or to rebuild master of SQL server 2008

Consider that after rebuild you will have a fresh SQL server instance. You will need to attach or restore your databases, recreate logins and so on.

MS Dynamics CRM 4.0 – Customizing the Report Wizard Template

January 24, 2009

The report wizard functionality of Microsoft Dynamics CRM 4.0 allows end users to quickly and easily create basic Reporting Services reports. After the user completes the wizard, CRM creates an RDL file that can then be rendered within the CRM Reporting Services viewer. A common question we get is how to change the template used by the report wizard. Well, my colleague, Brian, found a solution to this request. In this post, we discuss how to add your company logo to the report template used by the wizard.
Note: This approach is definitely unsupported, so use at your own risk!
We will go through the following steps to update the template:
1. Backup the existing template
2. Create a simple tool to extract the template from the database
3. Customize the template by adding our logo to the header
4. Import the template back to the SQL database

Step 1 – Backup existing template
The report wizard template is located in the body field of the ApplicationBaseFile table within the _MSCRM database. We recommend that you back up this data prior to any alterations. You can do this simply by executing the following SQL statement in the _MSCRM database which creates a backup table in your _MSCRM database to store the template data:
select body into dbo.ApplicationFileBase_Backup from ApplicationFileBase
Creating your own tables within the _MSCRM database is typically frowned upon, so you could instead copy this to a backup table in another database.

Step 2 – Extract template from SQL
Unfortunately, since SQL Management Studio limits its output to 64KB, retrieving the template is not as simple as just selecting the body text and copy and pasting into your favorite XML editor. While there are a number of ways to accomplish this, we decided to write a very simple .NET application to extract the template. Create a console application in Visual Studio, and paste in the following code. Be sure to update the sqlServerName and databaseName variables with your information. Run the application and your template will be saved on the c: drive in a file called report_template.xml.

using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using System.IO;

namespace CrmExtractTemplate
class Program
static void Main(string[] args)
//update the sql server name
string sqlServerName = “sqlserver”;
string databaseName = “organization_mscrm”;
string connectionString = String.Format(“Data Source={0};Initial Catalog={1};Integrated Security=SSPI”, sqlServerName, databaseName);

SqlConnection conn = new SqlConnection(connectionString);

string sqlText = “select body from applicationfilebase”;
SqlCommand cmd = new SqlCommand(sqlText);

cmd.Connection = conn;
cmd.CommandType = CommandType.Text;

SqlDataReader rdr = cmd.ExecuteReader();

while (rdr.Read())
TextWriter log = TextWriter.Synchronized(File.AppendText(@”c:\report_template.xml”));

Step 3 – Add your logo to the template file
The report wizard template is a custom XSL stylesheet that CRM uses to transform into a valid RDL file. To update it, you need to find the actual RDL code, which is located within the node. This area contains all of the RDL XML. The default template doesn’t include a node, so you need to add one with your image information.
Now that you know where in the template file to add the image, you need to determine what XML to add. The easiest way to do that is to actually create a new report in a tool like Visual Studio .NET or Business Intelligence Design Studio. Also, by creating it first in a tool, you can be sure of the placement and sizing settings.
You can add an image as an external link or embed it in the report. The code for an external image would look similar to:

However, if the image is small enough, you could also choose to embed it in the report. To do this, you would not only add the node as shown before, but also add an node with the image. The code for the embedded image approach would look similar to:

This code can be placed anywhere within the parent node in the template file.

Step 4 – Import the template file back to SQL Server
Luckily, you don’t need to rely on .NET to get the file back into SQL Server. Copy your template file to the c:\drive of your SQL Server, and then from SQL Management Studio, execute the following SQL:
create table dbo.ApplicationFileBase_tempLoad
Body xml

insert ApplicationFileBase_tempLoad (body)
select BulkColumn from openrowset( bulk ‘C:\Report_Template.xml’, Single_Blob) as Body

update ApplicationFileBase
set Body = (select top 1 convert(nvarchar(max), Body) from ApplicationFileBase_tempLoad)

drop table dbo.ApplicationFileBase_tempLoad
Now when you create a new report wizard, your new logo appears in the top left corner of the report!

MS Dynamics CRM 4.0 – Adding Notes to a Workflow E-mail

January 23, 2009

In a recent post on the Microsoft Dynamics CRM Team blog, Jim Steger discuss how you can easily overcome some of the native limitations of the CRM workflow Send E-mail action with some simple workflow assembly classes. Recently, I have been implementing the new eService Accelerator for our own corporate web site and came across a need for another CRM workflow e-mail utility…the ability to include all the notes of a record into the body of a workflow e-mail.
To accomplish this, I created a new activity class within my workflow utilities project and used the following code:

using System;
using System.Workflow.ComponentModel;
using System.Workflow.Activities;
using System.Web.Services.Protocols;
using Microsoft.Crm.Sdk;
using Microsoft.Crm.SdkTypeProxy;
using Microsoft.Crm.Sdk.Query;
using Microsoft.Crm.Workflow;
using System.Collections;
using System.Text;

namespace SonomaPartners.Crm.Workflow.Utilities
[CrmWorkflowActivity(“Format Notes”, “Utilities”)]
public partial class FormatNotes : SequenceActivity
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
IContextService contextService = (IContextService)executionContext.GetService(typeof(IContextService));
IWorkflowContext ctx = contextService.Context;
ICrmService service = ctx.CreateCrmService();

this.FormattedNotes = BuildNotesString(service, ctx.PrimaryEntityId);

return base.Execute(executionContext);

public static DependencyProperty FormattedNotesProperty = DependencyProperty.Register(“FormattedNotes”, typeof(string), typeof(FormatNotes));
[CrmOutput(“Formatted Notes”)]
public string FormattedNotes
get { return (string)base.GetValue(FormattedNotesProperty); }
set { base.SetValue(FormattedNotesProperty, value); }

private string BuildNotesString(ICrmService service, Guid id)
StringBuilder results = new StringBuilder();

BusinessEntityCollection notes = new BusinessEntityCollection();
notes = RetrieveNotesForId(service, id);

foreach (annotation note in notes.BusinessEntities)
“, note.subject));

“, note.notetext));

return results.ToString();

private BusinessEntityCollection RetrieveNotesForId(ICrmService service, Guid id)
QueryByAttribute query = new QueryByAttribute();
query.EntityName = “annotation”;
query.ColumnSet = new ColumnSet(new String[] { “subject”, “notetext”, “createdby”, “createdon” });

query.Attributes = new String[] { “objectid” };
query.Values = new Object[] { id };
query.Orders = new ArrayList();
query.Orders.Add(new OrderExpression(“createdon”, OrderType.Descending));

RetrieveMultipleRequest request = new RetrieveMultipleRequest();
request.Query = query;

RetrieveMultipleResponse returnedNotes = (RetrieveMultipleResponse)service.Execute(request);
return returnedNotes.BusinessEntityCollection;
catch (SoapException ex)
throw new Exception(ex.Detail.InnerText);

Now, your e-mail includes any notes in the body of the message

MS Dynamics CRM 4.0 – Displaying the Number of Notes on the Notes Tab

January 22, 2009

The Microsoft CRM default form layout displays the Notes section on a separate tab. I often hear complaints from users that they don’t know if any notes have been added without first clicking that tab. Many people don’t realize that just as with any other section, you can move the Notes section to another tab, just as you would any other section. So one approach that many of our users have liked is to place the Notes section on the first tab as shown below.

This works, but I personally find it annoying as the the cursor will ‘jump’ down to the Notes section, sometimes scrolling past the info on top set of information, and you have less room to see multiple notes. Since I tend to keep the Notes section on its own separate tab, I wanted to find a way to let users know that data exists on that tab prior to clicking it. I created the following script to display the number of notes on the tab label as shown in the screen shot below.

The script I used is shown below and should be added to the entity’s form onLoad function. Since this approach is entirely script based, it should also work on CRM Online. The tab where the Notes section exists must be called Notes for the script to work.

var totalNotes = getTotalNotes(crmForm.ObjectId);
function setNoteTabName(count) {
    /* update note tab */
    if (crmForm.FormType != 1) {
        var cells = document.getElementsByTagName(“A”);
        for (var i = 0; i 0) {
                        cells[i].innerText = “Notes (” + count + “)”;
               = “auto”;
// Helper method to return the total notes associated with an object
function getTotalNotes(objectId) {
        // Define SOAP message
        var xml =
        var resultXml = executeSoapRequest(“RetrieveMultiple”, xml);
        return getMultipleNodeCount(resultXml, “q1:createdon”);
// Helper method to execute a SOAP request
function executeSoapRequest(action, xml) {
    var actionUrl = “”;
    actionUrl += action;
    var xmlHttpRequest = new ActiveXObject(“Msxml2.XMLHTTP”);
    xmlHttpRequest.Open(“POST”, “/mscrmservices/2007/CrmService.asmx”, false);
    xmlHttpRequest.setRequestHeader(“SOAPAction”, actionUrl);
    xmlHttpRequest.setRequestHeader(“Content-Type”, “text/xml; charset=utf-8”);
    xmlHttpRequest.setRequestHeader(“Content-Length”, xml.length);
    var resultXml = xmlHttpRequest.responseXML;
    return resultXml;
// Helper method to return total # of nodes from XML
function getMultipleNodeCount(tree, el) {
    var e = null;
    e = tree.getElementsByTagName(el);
    return e.length;

Naturally, all of the caveats apply…this code is presented as is and may not upgrade with future releases of Microsoft CRM.
Finally, since we are discussing Notes, a hot fix exists if you see that your Notes area just displays the spinning icon as referenced in this KB article:

Microsoft Microsoft Office PerformancePoint 2007

January 21, 2009

Di seguito invio una serie di collegamenti che possono tornare utili sulla offerta di Business Intelligence di Microsoft:

Virtual Machine con DEMO su tutti i prodotti presenti nell’offerta di Business Intelligence di Microsoft

Webcast di introduzione a Microsoft Office PerformancePoint 2007

Blog molto valido su Microsoft Office PerformancePoint 2007

Download delle guide operative a Microsoft Office PerformancePoint 2007

La replica in Microsoft SQL Server 2005

January 20, 2009

Di seguito tre link di riferimento per analizzare i problemi di replica in Microsoft SQL Server 2005.

Troubleshooting Guidance for Replication Issues:

Replication Troubleshooting Tools:

How to: Configure a Firewall for SQL Server Access:

OrangeHRM Human Resource Management

January 18, 2009

OrangeHRM is an Open Source HRM information system that will provide a vast range of features to manage the crucial organization asset – people. It provides a perfect platform for re-engineering and aligning your HR processes along with the organizational goals.

Administration Module (Admin)
Personal Information Manager Module (PIM)
Employee Self Service Module (ESS)
Reports Module
Leave Module
Time and Attendance Module (Time)
Benefit Module
Recruitment Module