Custom Stored Procedure returns an unspecified error during Gather phase.
For a customer I have set up MDT 2010 on a Windows 2003 SP2 server. I have configured the MDT database on the same machine using SQL 2008 Express.
Using the steps outlined on
http://www.deployvista.com/Home/tabid/36/EntryID/120/language/en-US/Default.aspx I have created a stored procedure that automatically creates computer entries in the MDT database (I used a slightly modified version which I also used succesfully for
another customer - see below).
However, during the installation I get an error during the Gather phase:
About to issue SQL statement: EXECUTE IdentifyComputer 'B8:AC:6F:xx:xx:xx', 'True', 'False', 'False'
ERROR - Opening Record Set (Error Number = -2147467259) (Error Description: Unspecified error).
ADO error: Unspecified error (Error #-2147467259; Source: Microsoft OLE DB Provider for SQL Server; SQL State: ; NativeError: 0)
Unable to execute database query.
If I run the same query through the Management Studio, I get no errors.
Can anyone help me shed some light on this weird error?
USE [MDT]
GO
/****** Object: StoredProcedure [dbo].[IdentifyComputer] Script Date: 10/19/2010 16:47:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[IdentifyComputer]
@MacAddress CHAR(17),
@IsDesktop CHAR(10),
@IsLaptop CHAR(10),
@IsServer CHAR(10)
/* @Make VARCHAR(50), */
/* @Model VARCHAR(50) */
AS
DECLARE @Cnt INT,
@Prefix VARCHAR(50),
@Sequence INT,
@NewName VARCHAR(50)
SET NOCOUNT ON
/* See if there is an existing record for this machine */
SELECT @Cnt=COUNT(*) FROM ComputerIdentity
WHERE MacAddress = @MacAddress
/* No record? Add one. */
IF @Cnt = 0
BEGIN
/* Create a new machine name */
BEGIN TRAN
SELECT @Prefix=Prefix, @Sequence=Sequence FROM MachineNameSequence
WHERE IsDesktop = @IsDesktop AND IsLaptop = @IsLaptop AND IsServer = @IsServer
SET @Sequence = @Sequence + 1
UPDATE MachineNameSequence SET Sequence = @Sequence
WHERE IsDesktop = @IsDesktop AND IsLaptop = @IsLaptop AND IsServer = @IsServer
SET @NewName = @Prefix + Right('0000'+LTrim(Str(@Sequence)),4)
/* Insert the new record */
INSERT INTO ComputerIdentity (Description, MacAddress)
VALUES (@NewName, @MacAddress)
INSERT INTO Settings (Type, ID, OSDComputerName, OSDInstallSilent, OSInstall)
VALUES ('C',@@IDENTITY, @NewName, '1', 'Y')
COMMIT TRAN
END
/* Return the record as the result set */
SELECT * FROM ComputerIdentity
WHERE MacAddress = @MacAddress
The table MachineNameSequence is set up as following:
USE [MDT]
GO
/****** Object: Table [dbo].[MachineNameSequence] Script Date: 10/20/2010 10:08:47 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[MachineNameSequence](
[Prefix] [varchar](50) NULL,
[Sequence] [int] NOT NULL,
[IsDesktop] [varchar](50) NOT NULL,
[IsLaptop] [varchar](50) NOT NULL,
[IsServer] [varchar](50) NOT NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[MachineNameSequence] ADD CONSTRAINT [DF_MachineNameSequence_IsDesktop] DEFAULT ('False') FOR [IsDesktop]
GO
ALTER TABLE [dbo].[MachineNameSequence] ADD CONSTRAINT [DF_MachineNameSequence_IsLaptop] DEFAULT ('False') FOR [IsLaptop]
GO
ALTER TABLE [dbo].[MachineNameSequence] ADD CONSTRAINT [DF_MachineNameSequence_IsServer] DEFAULT ('False') FOR [IsServer]
GO
The customsettings.ini:
[Settings]
Priority=IdentifyComputer, CSettings, CPackages, CApps, CAdmins, CRoles, Locations, LSettings, LPackages, LApps, LAdmins, LRoles, MMSettings, MMPackages, MMApps, MMAdmins, MMRoles, RSettings, RPackages, RApps, RAdmins, Default
Properties=MyCustomProperty
[Default]
OSInstall=Y
SkipWizard=YES
[IdentifyComputer]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
StoredProcedure=IdentifyComputer
Parameters=MacAddress,IsDesktop,IsLaptop,IsServer
[CSettings]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=ComputerSettings
Parameters=UUID, AssetTag, SerialNumber, MacAddress
ParameterCondition=OR
[CPackages]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=ComputerPackages
Parameters=UUID, AssetTag, SerialNumber, MacAddress
ParameterCondition=OR
Order=Sequence
[CApps]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=ComputerApplications
Parameters=UUID, AssetTag, SerialNumber, MacAddress
ParameterCondition=OR
Order=Sequence
[CAdmins]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=ComputerAdministrators
Parameters=UUID, AssetTag, SerialNumber, MacAddress
ParameterCondition=OR
[CRoles]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=ComputerRoles
Parameters=UUID, AssetTag, SerialNumber, MacAddress
ParameterCondition=OR
[Locations]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=Locations
Parameters=DefaultGateway
[LSettings]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=LocationSettings
Parameters=DefaultGateway
[LPackages]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=LocationPackages
Parameters=DefaultGateway
Order=Sequence
[LApps]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=LocationApplications
Parameters=DefaultGateway
Order=Sequence
[LAdmins]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=LocationAdministrators
Parameters=DefaultGateway
[LRoles]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=LocationRoles
Parameters=DefaultGateway
[MMSettings]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=MakeModelSettings
Parameters=Make, Model
[MMPackages]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=MakeModelPackages
Parameters=Make, Model
Order=Sequence
[MMApps]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=MakeModelApplications
Parameters=Make, Model
Order=Sequence
[MMAdmins]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=MakeModelAdministrators
Parameters=Make, Model
[MMRoles]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=MakeModelRoles
Parameters=Make, Model
[RSettings]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=RoleSettings
Parameters=Role
[RPackages]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=RolePackages
Parameters=Role
Order=Sequence
[RApps]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=RoleApplications
Parameters=Role
Order=Sequence
[RAdmins]
SQLServer=da-ttai-01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=DeploymentShare$
Table=RoleAdministrators
Parameters=Role
October 20th, 2010 11:29am
Have you added the user (network access account) as a security login to the database, and assigned Execute permissions on the stored procedure itself?
/ Johan
Free Windows Admin Tool Kit Click here and download it now
October 20th, 2010 2:13pm
Yes I have; I even launched the Management Studio under the account in question and could perform the stored procedure without issues.
I'm starting to think this is connection related, however the ZTIGather.log file states (immediatly followed by the error mentioned above):
Connecting to SQL Server using connect string: Provider=SQLOLEDB;OLE DB Services=0;Data Source=da-ttai-01\SQLEXPRESS;Initial Catalog=MDT;Network Library=DBNMPNTW;Integrated Security=SSPI
Successfully opened connection to database
October 20th, 2010 5:28pm
I followed the steps outlined on
http://deployment.xtremeconsulting.com/tag/ztigather/ to troubleshoot this issue, and got an access denied to every database connection attempt that was made. I then used a "net use
\\servername\DeploymentShare$ /user:domain\username" to create a connection with the correct credentials, and all connections succeeded *including* the custom procedure. So, somehow, the custom procedure was
not using the right credentials in the first place.
I'm going to try and add the credentials to the role that I have defined in MDT and see if this fixes the issue.
EDIT: Well that didn't do a thing.
So how come that when I run ZTIGather.wsf manually that it works, but when it's run as part of the deployment, I'm getting this error?!
Free Windows Admin Tool Kit Click here and download it now
November 3rd, 2010 7:29am
I followed the steps outlined on
http://deployment.xtremeconsulting.com/tag/ztigather/ to troubleshoot this issue, and got an access denied to every database connection attempt that was made. I then used a "net use
\\servername\DeploymentShare$ /user:domain\username" to create a connection with the correct credentials, and all connections succeeded *including* the custom procedure. So, somehow, the custom procedure was
not using the right credentials in the first place.
I'm going to try and add the credentials to the role that I have defined in MDT and see if this fixes the issue.
November 3rd, 2010 7:30am
Hi,
We have the exact same problem did you ever find a solution to this problem?
regards,
Remco
Free Windows Admin Tool Kit Click here and download it now
May 17th, 2011 3:30am
I have the same problem. Any solution to this problem?
/Peter
July 4th, 2011 10:02am
Please post the ZTIGather.log, and your cs.ini file (post a link to the logs, don't paste their content)
/ Johan
Regards / Johan Arwidmark Twitter: @jarwidmark Blog: http://www.deploymentresearch.com FB: www.facebook.com/deploymentresearch
Free Windows Admin Tool Kit Click here and download it now
July 4th, 2011 11:16am