Link to home
Start Free TrialLog in
Avatar of arcj1234
arcj1234

asked on

scripting SQL logins using VB

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?
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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