Unable to create DSN using Group Policy Preferences, unspecified error 0x80004005

This article provides help to fix the error 0x80004005 that occurs when you configure a Data Source Name (DSN) using Group Policy Preferences (GPP).

Applies to:   Windows 10 - all editions, Windows Server 2012 R2
Original KB number:   2001454

Symptoms

Attempts to configure a DSN using GPP may result in error events similar to the following:

Event ID: 4098
Source: Group Policy DataSources
Description: The computer <Preference Name> preference item in the <GPO Name>. Group Policy object did not apply because it failed with error code 0x80004005 unspecified error. This error was suppressed.

If client-side debug logging is enabled, the following error messages may be recorded in the debug log:

<DateTime> [pid=0x70,tid=0x91c] Invalid keyword-value pairs [ hr = 0x80004005 "Unspecified error" ]
<DateTime> [pid=0x70,tid=0x91c] createDsn [ hr = 0x80004005 "Unspecified error" ]
<DateTime> [pid=0x70,tid=0x91c] Properties handled. [ hr = 0x80004005 "Unspecified error" ]

To enable GPP debug logging, enable the relevant policy setting below:

Windows Server 2008

Computer Configuration\Policies\Administrative Templates\System\Group Policy\Logging and Tracing\Data Source Policy processing

Windows Server 2008 R2, Windows 7

Computer Configuration\Policies\Administrative Templates\System\Group Policy\Logging and Tracing\Configure Data Sources preference logging and tracing

In the Event Logging section, select Informational, Warnings, and Errors. Tracing should be set to On.

The default locations for the log file are listed below. Both the location and name of the log file are configurable.

Windows Server 2003, Windows XP

%SystemDrive%\Documents and Settings\All Users\Application Data\GroupPolicy\Preference\Trace\Computer.log

Windows Server 2008 R2, Windows 7, Windows Server 2008, Windows Vista

%SystemDrive%\ProgramData\GroupPolicy\Preference\Trace\Computer.log

Cause

The error condition occurs if you attempt to configure username and password for the DSN policy using GPP. Username and password are not valid keywords when configuring a SQL Server DSN. For more information about the valid SQL Server-specific keyword/value pairs for data source configuration attribute strings, visit this Microsoft Web site.

Resolution

When configuring SQL connections, the only way to make the connection transparent for the user is to set Trusted_Connection to Yes. Otherwise, the user will be prompted for credentials when trying to connect. You must also ensure that attributes not listed in the above MSDN link, including username and password, are left blank (not configured) within the policy when configuring SQL connections.