473,231 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

script to copy logins and users with all permissions

Hello all,
I am looking for the script, which I believe exists already.I need to
be able to populate the script for security of one database and
apply it to another database, even if it is located on another server:
1. All logins which not exist have to be created and which exists
ignored including the NT accounts
2. Users same as the old database + the existing ones stay in database
3. Passwords for the new logins.
4. All permissions/grants on all objects for the users that exists
(usually it's the case) and ignore those that don't.
I have script which does some of it, but it's not perfect, so every
time there are some errors.
Please let me know, if you need me to email script that I have. It's
pretty long so I cannot just post it in here.
Thank you in advance.

Jan 25 '07 #1
3 30283
Inna,

If on SQL 2K, use Enterprise Manager.
Right click the database/All Tasks/Generate SQL Script.
Click the Options tab and you can select all of the logins and object
permissions you need.

-- Bill
"Inna" <me****@hotmail.comwrote in message
news:11*********************@v45g2000cwv.googlegro ups.com...
Hello all,
I am looking for the script, which I believe exists already.I need to
be able to populate the script for security of one database and
apply it to another database, even if it is located on another server:
1. All logins which not exist have to be created and which exists
ignored including the NT accounts
2. Users same as the old database + the existing ones stay in database
3. Passwords for the new logins.
4. All permissions/grants on all objects for the users that exists
(usually it's the case) and ignore those that don't.
I have script which does some of it, but it's not perfect, so every
time there are some errors.
Please let me know, if you need me to email script that I have. It's
pretty long so I cannot just post it in here.
Thank you in advance.

Jan 26 '07 #2
On Jan 25, 7:04 pm, "AlterEgo" <altereg...@dslextreme.comwrote:
Inna,

If on SQL 2K, use Enterprise Manager.
Right click the database/All Tasks/Generate SQL Script.
Click the Options tab and you can select all of the logins and object
permissions you need.

-- Bill

"Inna" <med...@hotmail.comwrote in message

news:11*********************@v45g2000cwv.googlegro ups.com...
Hello all,
I am looking for the script, which I believe exists already.I need to
be able to populate the script for security of one database and
apply it to another database, even if it is located on another server:
1. All logins which not exist have to be created and which exists
ignored including the NT accounts
2. Users same as the old database + the existing ones stay in database
3. Passwords for the new logins.
4. All permissions/grants on all objects for the users that exists
(usually it's the case) and ignore those that don't.
I have script which does some of it, but it's not perfect, so every
time there are some errors.
Please let me know, if you need me to email script that I have. It's
pretty long so I cannot just post it in here.
Thank you in advance.- Hide quoted text -

- Show quoted text -
Hello,
I cannot use Enterprise Manager, because every time it has to be done
for different database and this script is a part of another process
and it uses database name and server name as parameter.
Is there way just to populate script for any database, from query
analyzer?

Jan 30 '07 #3
On Jan 30, 3:26 pm, "Inna" <med...@hotmail.comwrote:
On Jan 25, 7:04 pm, "AlterEgo" <altereg...@dslextreme.comwrote:
Inna,
If on SQL 2K, use Enterprise Manager.
Right click the database/All Tasks/Generate SQL Script.
Click the Options tab and you can select all of the logins and object
permissions you need.
-- Bill
"Inna" <med...@hotmail.comwrote in message
news:11*********************@v45g2000cwv.googlegro ups.com...
Hello all,
I am looking for the script, which I believe exists already.I need to
be able to populate the script for security of one database and
apply it to another database, even if it is located on another server:
1. All logins which not exist have to be created and which exists
ignored including the NT accounts
2. Users same as the old database + the existing ones stay in database
3. Passwords for the new logins.
4. All permissions/grants on all objects for the users that exists
(usually it's the case) and ignore those that don't.
I have script which does some of it, but it's not perfect, so every
time there are some errors.
Please let me know, if you need me to email script that I have. It's
pretty long so I cannot just post it in here.
Thank you in advance.- Hide quoted text -
- Show quoted text -

Hello,
I cannot use Enterprise Manager, because every time it has to be done
for different database and this script is a part of another process
and it uses database name and server name as parameter.
Is there way just to populate script for any database, from query
analyzer?
AlterEgo's point is - let Enterprise manager generate the sql for you.
It will give you a starting point and you can change the code to be
specific for your application.
Feb 1 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Willoughby Bridge | last post by:
I am trying to create a php script to allows users to upload photos: The first file looks like this: <html> <head>
0
by: Dave Pylatuk | last post by:
Hello all. I am wondering if there is an easy way to prevent users from connecting to the same database more than once at a time. Ie. I do not want 'joe' users sharing logins. Thanks in...
9
by: jab3 | last post by:
So I'm considering a small project that involves online file storage. Let's say I wanted to set up a site that allows people to log-on, create an account, and then have space to upload files. The...
2
by: happyjenny52 | last post by:
Hi, I work as an IT Administrator and part of my job role is to use Enterprise Manager and Query Analyzer to backup the logins and permissions for each database on our SQL Servers. This...
2
by: Will | last post by:
I do not understand the sequence in which to add logins/users. A couple of things to note. I can not use vbscript - it has to be done using the sqldmo objects (or in a sql script). The sequence...
22
by: hamarsheh | last post by:
please i need you'r help .. we are designing a web site and we need a critical code in php for security , we have to read users permissions on files in the local network ,to give them the real...
1
by: Paulo | last post by:
Hi, can you help on a best logic to do a users permissions? Each module on menu must have a number? example: 1 - Customers 2 - Employers 3 - Reports etc so example in table database the...
4
by: nokia33948 | last post by:
Hi there, I am writing a VB.NET 2005 application that connects to an MySQL DB (it could be MS SQL, one day...). One of the window forms contains a gridview with some rows coming from a table on...
0
by: TintuMJ | last post by:
How can we generate a Script with all user permissions of all users in a particular database in SQL Server 2005. It should be in such a way that if we run this script later, all these permissions are...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.