Tuesday, 30 December 2008

Error ''Item has already been added'' when trying to set Resource Type in a CMDB or Connector Rule

Applies To

• Altiris Connector 6.5
• CMDB 6.5


Problem/Symptoms

After upgrading to CMDB/Asset 6.5, when trying to set the Resource Type within a CMDB or Connector rule, the following error may be shown:

Module: AltirisNativeHelper.dll
Source: global.asax
Description: Unhandled exception.  Type=System.ArgumentException Msg=Item has already been added.  Key in dictionary: "8b92ef99-7bac-49a0-8694-48d7558bc7ee"  Key being added: "8b92ef99-7bac-49a0-8694-48d7558bc7ee"
StackTrace=
   at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
   at System.Collections.Hashtable.Add(Object key, Object value)
   at Altiris.NS.Connector.Web.ImportExportRule.CreateDataClassesMappingsTable(Boolean bReloadColumns, Boolean bSetSavedValues)
   at Altiris.NS.Connector.Web.ImportExportRule.CreateAllMappingControls(Boolean bReloadColumns, Boolean bSetSavedValues)
   at Altiris.NS.Connector.Web.ImportExportRule.ResourceType_Change(Object sender, EventArgs e)
   at System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e)
   at System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent()
   at System.Web.UI.Page.RaiseChangedEvents()
   at System.Web.UI.Page.ProcessRequestMain()

The following Resource Types have been reported as affected by this issue, others could be affected:

Computer
Monitor
Network Printer
Office Equipment
Peripheral
Scanner


Cause

This can be caused by having the Accounting Information data class directly associated to a child Resource Type and the child's Base Resource Type, Asset.


Resolution

  1. Back up the Altiris database
  2. Run the following sql script against the Altiris database


--Set up @ResourceTypeDataClassAssoc table variable
DECLARE @ResourceTypeDataClassAssoc TABLE
(
ResourceType nvarchar(250),
ResourceTypeGuid uniqueidentifier,
depth bit,
BaseResourceType nvarchar(250),
BaseResourceTypeGuid uniqueidentifier,
DataClass nvarchar(250),
ResourceDataClassGuid uniqueidentifier
)

/*
populate @ResourceTypeDataClassAssoc with data classes
associated to resource types at each level in the hierarchy
*/
INSERT INTO @ResourceTypeDataClassAssoc
SELECT i.name as ResourceType, rth.ResourceTypeGuid, rth.depth, i2.name as BaseResourceType,
rth.BaseResourceTypeGuid, i3.name as DataClass, rtdc.ResourceDataClassGuid
FROM ResourceTypeHierarchy rth
JOIN item i on rth.ResourceTypeGuid = i.Guid
JOIN item i2 on rth.BaseResourceTypeGuid = i2.Guid
JOIN ResourceTypeDataClass rtdc on rth.BaseResourceTypeGuid = rtdc.ResourceTypeGuid
JOIN item i3 ON rtdc.ResourceDataClassGuid = i3.Guid

/*
Find resource types that have data classes associated directly, and indirectly through
any base resource type in their hierarchy, and delete them from the ResourceTypeDataClass table
*/
DELETE FROM ResourceTypeDataClass
WHERE EXISTS
(
SELECT *
FROM @ResourceTypeDataClassAssoc rt1
  JOIN @ResourceTypeDataClassAssoc rt2 ON rt1.ResourceTypeGuid = rt2.ResourceTypeGuid
  AND rt1.BaseResourceType != rt2.BaseResourceType
  AND rt1.ResourceDataClassGuid = rt2.ResourceDataClassGuid
WHERE rt1.depth = 0
  AND ResourceTypeDataClass.ResourceTypeGuid = rt1.ResourceTypeGuid
  AND ResourceTypeDataClass.ResourceDataClassGuid = rt1.ResourceDataClassGuid
)

Tuesday, 9 December 2008

SBS 2003 and the 16 Gb Exchange limit solution

All credit goes to Michael for his post

http://weblog.techdad.net/2007/09/20/fix-it-sbs-2003-16-gig-exchange-limit-event-ids-9175-and-445/

  • Small Business Server 2003 - Release 2
  • Symptoms:
    • Users could not connect to Exchange via Outlook
    • Web Outlook was producing errors

Servers event logs showed following recurring errors:

Event Type: Error
Event Source: MSExchangeSA
Event Category: MAPI Session
Event ID: 9175
Date:  9/20/2007
Time:  3:53:59 PM
User:  N/A
Computer: XXXXXXXXX-SERVER
Description:
The MAPI call ‘OpenMsgStore’ failed with the following error:
The attempt to log on to the Microsoft Exchange Server computer has failed.
The MAPI provider failed.
Microsoft Exchange Server Information Store
ID no: 8004011d-0512-00000000

A search on that Event ID produced all sorts of interesting results. I must have read through the first 15-20 entries there and settled on this Microsoft Knowledge Base article (#320705). [NOTE: this is NOT what I ended up doing!] I started to go through the steps and decided before I started running command line switches on things, messing with moving the Information Store around or merging .PST files, I would read up and dig around a bit more in the Event log.

I figured that it would be important to do a little forensics to see if I could see another event that may have caused the Information Store to crap out. So, I found an event that happened right before all of the 9175’s started happening. This is what it contained:

Event Type: Warning
Event Source: ESE
Event Category: Space Management
Event ID: 445
Date:  9/20/2007
Time:  1:46:26 PM
User:  N/A
Computer: XXXXXXXXX-SERVER
Description:
Information Store (4996) First Storage Group: The database F:\Exchsrvr\MDBDATA\priv1.edb has reached its maximum size of 16383 MB. If the database cannot be restarted, an offline defragmentation may be performed to reduce its size.

Back to Google to see if Exchange SP2 can be installed on SBS 2003…and I came across this FAQ on Microsoft. In it, I came upon the answers I was looking for:

Q. Does SP2 work on Microsoft Windows Small Business Server 2003?
A. Yes. Windows Small Business Server 2003 with SP1 fully supports Exchange Server 2003 SP2. Exchange Server 2003 SP2 was tested to ensure compatibility.

Q. Did the storage limit change for SP2?
A. Based on feedback from customers and because of the evolution of e-mail usage, we are increasing the storage limit for Exchange Server 2003 Standard Edition with SP2 to 75 gigabytes (GB). In order to prevent the database from growing unexpectedly after an upgrade to SP2, the limit is set to 18 GB and can be set up to 75 GB by using a registry key. For more information about setting the limit, see the Exchange Server 2003 Help, updated during the SP2 installation.
Q. Does the storage limit change apply to Windows Small Business Server 2003?
A. Yes. Windows Small Business Server 2003 users can take advantage of the storage limit changes implemented in Exchange Server 2003 SP2.

GREAT! So the next thing was to get Exchange SP2 installed. The download is located here. (Saved you some search time, right?)

Installation went fine without issue. The installer stopped and started services as it was supposed to and everything updated perfectly. Once the install was complete, people could connect to Exchange via Outlook immediately. BUT WAIT! There was one more thing that had to be done after this upgrade. I guess that after the upgrade, the File Store is only updated to 18 Gigs (I believe). So, in order to really take advantage of more space, you have to do a registry hack. Here is what you need to do (oh, and one reminder: While I have personally done the steps above and they seemed to have worked for me, I cannot guarantee that they will work for you, nor that you are free from risk doing any of this stuff written above; you take these actions at your own risk and I will not be held responsible for anything “bad” that you may do to your computer...anyway…)
Here are the steps for the registry hack:

  1. Open your Registry Editor (if you don’t know how to do this…you shouldn’t be reading this article)
  2. Navigate to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSExchangeIS\<Servername>\Private-GUID
  3. Create a DWORD entry by right-clicking on the folder and selecting NEW > DWORD Value
  4. Enter a DECIMAL value of anything between 18 and 75 (making sure that it is not larger than the free space on the drive where your store resides)
  5. Do Steps 3 and 4 again with: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSExchangeIS\<Servername>\Public-GUID
  6. Exit the Registry Editor and go into Services and restart the “Microsoft Exchange Information Store”
  7. That’s it!

To check to see if your new setting was stored properly, wait a few minutes and then look for Event ID#1216. That event should give you details on your new Store size (example below).

Event Type: Information
Event Source: MSExchangeIS Mailbox Store
Event Category: General
Event ID: 1216
Date:  9/20/2007
Time:  4:25:24 PM
User:  N/A
Computer: XXXXXXXXX-SERVER
Description:
The Exchange store ‘First Storage Group\Mailbox Store (XXXXXXXXX-SERVER)’ is limited to 50 GB. The current physical size of this database (the .edb file and the .stm file) is 15 GB. If the physical size of this database minus its logical free space exceeds the limit of 50 GB, the database will be dismounted on a regular basis.

If you found this usefull remember to click on an AD.

thx,

Gert

Migrating a Citrix datastore ( access, sql express ) to Microsoft SQL ( sql , sql express )

I've found this post on one the forums and the procedure works like a charm !

Migrating a Citrix Access data store to Microsoft SQL Server 2005

The following instructions outline the process of migrating a Citrix MetaFrame XP Access data store to Microsoft SQL Server. Please note, this process requires the Citrix servers to be restarted and adequate backup measures should be taken prior to migration in case of failure. citrixInformation in this article has been taken from the following sources: • How to create a database for use as a data store using SQL Server (http://support.citrix.com/kb/entry!default.jspa?categoryID=118&entryID=3412)• Advanced Concepts - Farm Maintenance (http://support.citrix.com/kb/entry!default.jspa?categoryID=118&entryID=2188)
To migrate a Citrix Presetation Server data store to Microsoft SQL Server:

I. Create the target database on the SQL server:

1. Start SQL Enterprise Manager.

2. in the left-hand pane, expand the tree until you reach folder level.

3. Right-click on the databases folder and select New Database

4. In the dialog box, enter a name into the Name textbox and click OK. The name entered is not important.

5. Expand the security folder.

6. Right-click Logins and select New Login

7. A dialog box appears with the General tab displayed. In the Name textbox, enter a username for the new login. Make a note of this username, as you will need it during the migration procedure.

8. In the Authentication section of the General tab, click SQL Server Authentication and enter a password. Make a note of this password, as you will need it during the migration procedure.

9. In the Defaults are of the General tab, change the database to the name you specified in step 4.

10. Click the Database Access tab. In the Database list, select the database name specified in step 4.

11. In the Database Roles list, select DB_Owner. Leave the other selected roles checked. 12. Click OK. You are prompted to confirm your password at this point. 13. The database isnow created. Exit SQL Enterprise Manager.

II. Create a new DSN file pointing to the database created above:

1. Start ODBC Data Source Administrator.

2. Select the File DSN tab, and click Add.

3. In the driver list, select SQL Server and click Next.

4. Click Browse and navigate to the %PROGRAMFILES%\Citrix\Independent Management Architecture folder. Enter a filename for the DSN. Click OK then click Next.

5. Confirm the information entered, then click Finish.

6. The Create a new Data Source to SQL Server dialog, enter a description if required.

7. In the SQL Server box, enter the name of the SQL Server on which the database has been created. Click Next.

8. Click With SQL Server authentication using a login ID and password entered by the user then enter the Login ID and password of the database user created above. Click Next

9. Check Change the default database to and select the name of the database created above. Click Next, then click Finish.

10. In the ODBC Microsoft SQL Server Setup dialog, click Test Data Source button to ensure connectivity. Once finished, click OK to finalise DSN creation.

III. On the host server, start Command Prompt and change to the %PROGRAMFILES%\Citrix\Independent Management Architecture folder.

IV. Execute the dsmaint migrate command with the following parameters:

dsmaint migrate /srcdsn:path and name of existing DSN /srcuser:leave blank /srcpwd:leave blank /dstdsn:path and name of new DSN /dstuser:new DSN login name /dstpwd:new DSN password

V. Once the migration procedure has finished (it can take anywhere from a few seconds to a few minutes), execute the dsmaint config command with the following parameters: dsmaint config /user:new DSN login name /pwd:new DSN password /dsn:path and name of new DSN ds

VI. Stop and restart the IMA service. After the IMA service has restarted, all other servers begin accessing the new data store through the host server. t Please note: Restarting the IMA Service may cause the SNMP service to Dr Watson if SNMP is enabled. This is benign and can safely be ignored.

VII. Copy the new DSN file to all other servers in the farm.

VIII. Execute the dsmaint config command on each server with the same parameters as above to establish a direct connection to the new data store.

IX. Stop and restart the IMA service on all remaining indirect servers in the farm.