January 31, 2011 at 1:48 pm
GOAL:
1) Get a listing of all Servers on the Domain.
2) Store list of Servers on table
3) Re-run Steps 1 & 2 on a schedule
DETAILS:
My end goal here is to periodically scan the domain for a listing of all the servers and then store that in a table in my ADMIN database. Once I have this info I can use plain old T-SQL to do what I need with it.
I currently know not how to do this in SQL Server, how to get a listing of all servers on the domain. I do however have a Powershell script that does this quite nicely. However the script does not store the results in anything on SQL Server but as text to a csv file.
If it’s possible to get this listing of servers using native SQL Server tech then I can ditch the Powershell script. If not then what I need is to figure out how to call this Powershell script on a schedule (like a step in a SQL Job) and then import the info saved to the csv file the Powershell script created. I thought that maybe SSIS might be able to call a Powershell script but a search on Google showed no results.
Any tips, suggestions on how to do this kind of thing? While I’m no fan of SSIS I’m open to it if it can do this kind of thing; either get a listing of domain servers and store to a table or execute a Powershell script and then upon the scripts successful completion, load the data into a table from the csv file the Powershell script created
Thanks
Kindest Regards,
Just say No to Facebook!January 31, 2011 at 2:05 pm
pipe the output of this into a table
sqlcmd -Lc
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
January 31, 2011 at 4:12 pm
Perry Whittle (1/31/2011)
pipe the output of this into a table
sqlcmd -Lc
Thanks for the suggestion but do you know if there is an equivelant syntax that shows all the servers on the domain?
Kindest Regards,
Just say No to Facebook!January 31, 2011 at 4:16 pm
YSLGuru (1/31/2011)
Perry Whittle (1/31/2011)
pipe the output of this into a table
sqlcmd -Lc
Thanks for the suggestion but do you know if there is an equivelant syntax that shows all the servers on the domain?
Hm, that's supposed to do so.
From here:
http://msdn.microsoft.com/en-us/library/ms162773.aspx
-L [ c ] list servers[clean output]
Lists the locally configured server computers, and the names of the server computers that are broadcasting on the network. This parameter cannot be used in combination with other parameters. The maximum number of server computers that can be listed is 3000. If the server list is truncated because of the size of the buffer a warning message is displayed.
Note
Because of the nature of broadcasting on networks, sqlcmd may not receive a timely response from all servers. Therefore, the list of servers returned may vary for each invocation of this option.
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA
March 2, 2011 at 4:06 pm
Craig Farrell (1/31/2011)
YSLGuru (1/31/2011)
Perry Whittle (1/31/2011)
pipe the output of this into a table
sqlcmd -Lc
Thanks for the suggestion but do you know if there is an equivelant syntax that shows all the servers on the domain?
Hm, that's supposed to do so.
From here:
http://msdn.microsoft.com/en-us/library/ms162773.aspx
-L [ c ] list servers[clean output]
Lists the locally configured server computers, and the names of the server computers that are broadcasting on the network. This parameter cannot be used in combination with other parameters. The maximum number of server computers that can be listed is 3000. If the server list is truncated because of the size of the buffer a warning message is displayed.
Note
Because of the nature of broadcasting on networks, sqlcmd may not receive a timely response from all servers. Therefore, the list of servers returned may vary for each invocation of this option.
Yeah that only shows the servers with SQL Server installed and broadcasting. I was hoping for a way to get a list of ALL computers or at least all WINDOWS SERVERS.
Thanks
Kindest Regards,
Just say No to Facebook!Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply