List of SQL Servers & more

Mar 17, 2014 at 8:33 AM
Edited Mar 17, 2014 at 8:33 AM
Hi Kendal

I've recently started using your SQL Power Doc solution for documenting my SQL Servers.

I have a few questions that I'm hoping you can clear up for me
  1. Is there a way to scan the network for SQL Servers without doing the actual discovery? I'm looking for a solution that will basically just give me a list of SQL Servers on my domain(s).
  2. Is there a way to do a batch conversion of XML's? I need to be able to feed it all the XML's I've collected and then it needs to convert all of them into separate Excel documents for each server, is this possible?
Any assistance would be appreciated
Coordinator
Apr 15, 2014 at 3:58 PM
Good questions! (and sorry it's taken me a while to reply - been insanely busy at work lately)
  1. Yes, you can use the NetworkScan module and the Find-SqlServerService function to find SQL Server Services. The parameters are a subset of what you'd use when you call Get-SqlServerInventoryToClixml.ps1. The following snippet will import the module and show you the options for parameters:
Import-Module -Name NetworkScan
Get-Help Find-SqlServerService 
  1. You could do something like Get-ChildItem to iterate through each XML file and call Convert-SqlServerInventoryClixmlToExcel.ps1. This doesn't help if you have several servers included in a single XML file, though. In that case you may want to call Get-SqlServerInventoryToClixml.ps1 for each server so that you just end up with one XML file per server.
--
Kendal
Apr 16, 2014 at 12:16 PM
Thanks Kendal

I've managed to find a way to do a batch conversion of XML's using the below and it works quite well
Get-Item "C:\Users\Me\Documents\Inventory\*.gz" | ForEach-Object {.\Convert-SqlServerInventoryClixmlToExcel.ps1 -FromPath $_.FullName}
I used the NetworkScan as you advised, it works great but outputs more info than I need. All I basically want is the server name.
Coordinator
Apr 29, 2014 at 3:07 PM
The nice thing about PowerShell is that you can filter out the stuff you don't want from the results, e.g.
Find-SqlServerService [parameters here] | select-object -property ServerName, ComputerName
--Kendal