August 2, 2004 at 5:06 am
Hi all,
i need to use xp_servicecontrol to monitor remote servers services.
Is it possible?
I need to check if a services of a remote server is running or not.
Please help me.
tks in advance.
Dafi
August 3, 2004 at 11:26 am
You might want to take the following approach:
Check for the syntax though, since I haven't tried it:
Link all your remote servers on single server. Configure it. Create a table 'Servers' with all your linked servers info, such as Server name, etc. Run a cursor against this table:
declare @servername varchar(128)
declare @serverid int
declare @sql varchar(1024)
Declare c1 cursor
For Select servername, serverid from Servers
Open c1 Fetch next from c1 into @servername, @serverid
While @@fetch_status = 0
Begin
select @sql = 'EXEC ' + @servername + '.master.dbo.xp_servicecontrol ''QueryState'', ''SQLServerAgent'''
Execute (@sql)
print (@sql)
fetch next from c1 into @servername, @serverid
end
close c1
deallocate c1
August 3, 2004 at 4:15 pm
hi!
you can use a command line utility called xnet, togheter xp_cmdshell extented proc, too !
exec master..xp_cmdshell 'xnet list \\servername'
this will list all services running on ther remote computer, but you have to be, at least, a power user on the remote machine.
you can download the xnet utility on the following link:
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply