We help IT Professionals succeed at work.

scripting SQL logins using VB

92 Views
Last Modified: 2015-09-30
Hello and thank you for helping me.  I have over 20 SQL servers where I have to grant local backup operator access, create an SQL login account and Grant sa access.  I would like to use a VB or batch script to read the servers from a file to grant the access and create the SQL account.  I am not sure how to proceed with this.  Can you please give some examples or link to where I can find the answer?
Comment
Watch Question

Senior Developer
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Marten RuneSQL Expert/Infrastructure Architect
CERTIFIED EXPERT

Commented:
Do you have access to them from SSMS???
If so, why not use a multiquery in SSMS.

in SSMS use "view/registered servers"
in "local Server Groups" rightclick and add a "New Server Group" name it to something good.
now register each of the 20 servers to this Group by rightclick on the Group and choose "New Server Registration"
When they are all in there, rightclick on the Group, and choose "New Query"
This Query will execute against all of the servers, try it out by typing:
Select @@ServerName
and hit enter
Youll see 20 columns, to understand this even simpler
wipe the Query and type:
Select name from sys.databases
hit enter
Now you can see all your databases, and in the first column it's automatically shown on wich server the result came from.

Regards Marten
Marten RuneSQL Expert/Infrastructure Architect
CERTIFIED EXPERT

Commented:
arcj1234

Any Feedback?!?
If the solutions are unacceptable, then write that this is the case and the reason. Otherwose you wont get any more proposed solutions.

Regards Marten
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.