Unable to add a computer to a Deployment Group if it was a member of a group which has been deleted

Version 1

    Verified Product Versions

    Management Center 10.1

    Introduction

    You find that when trying to manually add a computer to a Deployment Group, you receive the following error message:

    An unexpected error has occurred in the Management Console.

    'The value for column 'ExpectedGroupName' in table '

    DiscoveredMachines is DBNull.'

     

    > Unable to cast object of type 'System.DBNull' to type 'System.String'.

     

    This issue will only occur on Management Center versions from 10.1 FR2 and above.

     

    Detail

     

    This error can occur if the machine already has a record in the Machines table in the database (i.e. the machine has previously been managed by Management Center), but the Deployment Group it was a member of has been deleted. This will mean that the record will have an invalid ExpectedGroupFK which does not match an existing group, and this causes the error.

     

    Fix

     

    To fix this will require updating the machine records in the database. You may find that multiple machines are affected - any machines which were in the group which has been deleted. It will make sense to fix all of them in one go.

     

    Firstly, list the details of the machine that you are trying to add (replace 'MACHINENAME' with the NetBiosName of the machine you're trying to add):

     

    SELECT NetBiosName,ExpectedGroupFK FROM Machines WHERE NetBiosName LIKE 'MACHINENAME'
    

     

    Next, run the following script, but replace the ExpectedGroupFK on line 3 with the one returned by the SELECT statement above.

    Ivanti recommends you ensure you have a full database backup before running any scripts which change data.

    UPDATE Machines 
    SET ExpectedGroupFK = NULL 
    WHERE ExpectedGroupFK = 'CCE090EE-CFBC-4380-9050-EEB01D2D7AFE' 
    

     

    This script will replace the invalid ExpectedGroupFK with NULL for all machines. You will then be able to add the machines to the deployment group via the console.