June 25, 2007 at 4:15 am
hello,
not really sure where to put this question.
I need to disable a service running on approxiamtely 1200 servers but dont want to do it manually(i dont have the will power!)
i am thinking something along the lines of:
select distinct 'osql -S '+b.srvname+' -U XXXX -P XXXX -Q "set startuptype = disabled"'
from sysservers b inner join blah, blah, blah
but am having trouble with -Q "set startuptype = disabled" (its not right)
i can't do it with xp_cmdshell because it only allows stop/start as far as i can tell.
any advice/help/the solution would be appreciated
thanks
June 25, 2007 at 5:41 am
Do all your 1200 servers run with SQL Server. If not you have to find a way with vb script to change the properties of the service to disabled. Also check do you have that much privilege in all the servers/system. most companies restrict that privilege unless you are a domain admin.
Cheers,
Sugeshkumar Rajendran
SQL Server MVP
http://sugeshkr.blogspot.com
June 25, 2007 at 7:10 am
all 1200 servers are sql servers. i have the requisite permissons to make the change. the service is related to how we access the boxes. i cant uninstall the old software(pcanywhere) so need to disable it to stop people using it, therefore forcing them to use a new tool(dameware).
i just cant get the syntax i need.
any ideas that i can try would be appreciated
cheers
Jon Herd
June 25, 2007 at 7:19 am
One thing that i can think of as of now is to use the xp_regwrite procedure to write a batchfile to execute against all servers. Anyways all your services will be available under the registry path HKLM\system\currentcontrolset\services\servicename. you can edit the property of this key so that it disables the service that you specify. But take proper caution before editing anything in registry.
Cheers,
Sugeshkumar Rajendran
SQL Server MVP
http://sugeshkr.blogspot.com
June 26, 2007 at 7:22 am
There's an old windows admin tool called hyena that you can use to help generate scripts and .bat/.cmd files to do this type of thing.
I'd suggest a WMI script to do it, or you could the sc command from the command line.
sc [servername] config [service name] start=disabled
June 26, 2007 at 11:26 am
Jon,
Are you disabling the SQL Server service or other services?
If not the SQL Service- then my suggestion is as follows:
The company I work for (SQL Farms) has a product called SQL Farm Combine with which you can run the appropriate xp_cmdshell command to stop the service on all 1200 servers in parallel, in one-click. It will only take a few seconds. You don't even have to register the SQL Servers instances - if you have a listing of all your servers somewhere, then you can tell the tool to pick the server names from there.
If you need help writing the xp_cmdshell command- I'd be happy to assist.
Note: I'm not trying to sell you the product- If you need to do this operation one time only, your welcome to receive a free 21-day eval copy (eval copies can be used against unlimited # of servers). Just trying to help.
June 26, 2007 at 12:17 pm
In regards to another comment in your original posting-
every Win OS (starting with WIN2K and up) is quipped with the SC.exe command line utility through which you can control pretty much anything on the services.
You can use xp_cmdshell to call sc and stop / disable (or perform any other operations on the service).
For additional info, please refer to the KB at:
http://support.microsoft.com/default.aspx?scid=kb;en-us;251192
If you have any specific questions, please feel free to ask. I've done tons of work with sc and netsvc and other MS utilities to control services.
The other option is always WMI scripting- you can use those on your local machine to control remote services. This would depend on the set up of your network though.
Hope this helps.
June 27, 2007 at 4:53 am
All,
using sc.exe has done the trick!
i used
set nocount on
select distinct 'sc \\'+b.srvname+' config awhost32 start= disabled'
from sysservers b inner join database..syssubscriptions a on a.srvid = b.srvid
order by 1
this created the script which i saved as a .bat and ran on the master server.
i used a variation on a theme to stop the service as well.
thanks for the help guys
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply