July 8, 2010 at 5:59 am
Hi All,
Can anyone suggest me on the below query:
Am working as a Prod DB Support Engr. We have a requirement like to check if the account XYZ\SQL_DBA_XYZ has access on all the SQL Machines in my domain XYZ at a time.
As we are supporting 1400+ servers and its a big head ache to login into and check each server for access and have multiple instances in each box.
So was worried - If we can have a script or a query to get the information that these many servers have access to the account and with pwd provided and it should be enabled.
Sorry all, if I have asked a strange and silly question. But for me its a big deal, as it may take days & months on checking this. One more is if the login is not avail, I have to create and assign roles.
Please post me a reply and suggestions and let me know how can it be possible to have.
Cheers,
- Win.
" Have a great day "
July 8, 2010 at 6:17 am
I would do this outside of SQL with either a sqlcmd , cmd script or an application. personally doing it in vb.NET is easiest for me, your milage may vary.
the basic steps would be to get a list of all the servers....OSQL -L > C:\ServerList.txt from a cmd window would give you a text file of all the servers that are broadcasting their info.
you can also get the list of servers in a .NET application with the Imports
Microsoft.SqlServer.Management.Smo reference; Smo.SmoApplication.EnumAvailableSqlServers(False) returns a datatable of all the available servers, along with a lot more info(isLocal or not, more...
from there, then just create a loop that uses the exact same connection string over and over again, using trusted connection and substituting only the server name.
log which ones are failures and which connect, and you have your results.
- Win. (7/8/2010)
Hi All,Can anyone suggest me on the below query:
Am working as a Prod DB Support Engr. We have a requirement like to check if the account XYZ\SQL_DBA_XYZ has access on all the SQL Machines in my domain XYZ at a time.
As we are supporting 1400+ servers and its a big head ache to login into and check each server for access and have multiple instances in each box.
So was worried - If we can have a script or a query to get the information that these many servers have access to the account and with pwd provided and it should be enabled.
Sorry all, if I have asked a strange and silly question. But for me its a big deal, as it may take days & months on checking this. One more is if the login is not avail, I have to create and assign roles.
Please post me a reply and suggestions and let me know how can it be possible to have.
Lowell
July 8, 2010 at 7:00 am
Appreciate your fast help ..!!!
Can this be for every instance in every box for multiple instances as well.?
Can you please explain me in detail. As am not that much into .NET.
Need more help and better understanding.
Cheers,
- Win.
" Have a great day "
July 8, 2010 at 7:13 am
ok forget the do it yourself thing: download this free program:
it will scan your entire network in a LOT of differnet ways, and find all installations, including multiple instances ont he same server.
it will try to connect to each of them IF you put in the credentials.
here's a pair of screenshots from me hitting my network with ~40 servers/instances:
Lowell
July 8, 2010 at 9:05 am
You could also use a small powershell script:
function connectSQL([string]$serverName, [string]$instanceName) {
trap {
continue
}
$sqlServer = $serverName
if(!$instanceName.equals("")){
$sqlServer = $serverName + "\" + $instanceName
}
$cn2 = new-object system.data.SqlClient.SQLConnection("Data Source="+ $sqlServer +";Integrated Security=SSPI;Initial Catalog=master")
$cn2.Open()
Write-Host $sqlServer " : " $cn2.State
}
[System.Data.Sql.SqlDataSourceEnumerator]::Instance.GetDataSources() | ForEach-Object {connectSQL $_.ServerName $_.InstanceName}
Remember you have to start your sqlbrowser to make it work.
-- Gianluca Sartori
July 9, 2010 at 2:45 am
Excellent Lowell
You helped me alot.... Thanks a ton for your quick and prompt response.
Cheers,
- Win.
" Have a great day "
July 9, 2010 at 2:47 am
Gianluca Sartori,
Good One.... I will try to work with this script and post you.... Reply will be delayed, as I have to get confirmation and required permissions to do so.
Cheers,
- Win.
" Have a great day "
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply