Avatar of Carlos_Felipe
Carlos_Felipe
Flag for Brazil asked on

Modify default database for all logins

Due to enterprise policies, I need to modify all logins pointing to MASTER as default database.
Whoever is pointing to MASTER must point to a different database, such as TEMPDB.
The problem is that I have hundreds of servers running SQL Server 2000 or 2005 (default instance).
Is there a way to do it remotely through vbscript using SQLDMO?
My domain user account has sysadmin privileges against all those instances and I have a TXT file with all servers (one in each line).
Scripting LanguagesMicrosoft SQL Server

Avatar of undefined
Last Comment
chapmandew

8/22/2022 - Mon
chapmandew

wow....out of curiosity, what is the reasoning behind changing everyones default db?  You might be able to get away w/ it through DMO or SMO, but you'd have to decide how to connect to each one, and then load up all of the logins, cycle though them, figure out what their default db is, and then change it.  I can show you how to do it for a particular instance, but you'd need to run the script on each one of them.   Is that something you might be interested in?
Carlos_Felipe

ASKER
Please, share it.
ASKER CERTIFIED SOLUTION
chapmandew

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Carlos_Felipe

ASKER
Thanks! You helped me a lot!
Does it not work on SQL 2000?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
SOLUTION
chapmandew

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.