2

I’ve got an application that uses SQL Server Express 2005 SP3. This application is distributed to several hundred users, each of whom is running XP. However, our company will be moving to Windows7 soon. My application uses the bulk insert operation in SQL Server, and it runs fine in XP. However, in Windows7 I need to open SQL Server Management Studio, as Administrator, and execute the following command in order to get the bulk insert operation to run properly:

EXEC master..sp_addsrvrolemember @loginame = N'BUILTIN\Users', @rolename = N'bulkadmin'

Obviously it is impractical to do this manually on each user’s PC. So, I’m wondering how I can script this if the users aren’t running my application as administrator. Is it something that can be set in the SQL Server bootstrap package during installation? What about the existing installs?

2
  • I realise this is outside the scope of your exact question, but after installing SP3 on the Windows 7 machines, did the "User Provisioning Tool" run? Feb 22, 2010 at 20:48
  • No, it didn't run. The only user permissions options that appeared (which wasn't enabled by default) was the 'Add user to the SQL Server Administrators Role', but this is only valid for the current user.
    – jmbowse
    Feb 22, 2010 at 22:02

1 Answer 1

0

This can be done using an MSI package that will allow you to run certain commands as an administrator. The MSI that you will create will however need to be elevated in order to work. This is just the way things work in Windows 7, with UAC enabled and all.

Turning off UAC would be another idea, but it's really not the way to go.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy