I have this Script that I am working on where I am trying to find every SQL server on the network and collect a list containing Server Name, Every SQL Service/Instance name on the server, Type of SQL installed and version of each instance. I got as far as listing the service name and state and can't figure out how to get the SQL type and version. Would really appreciate the help. The stripped down "heart" of the code I have so far is below:
Try {
$Service = Get-WmiObject -Class $classname -ComputerName $Computer.DNSHostname`
-Namespace $namespace `
-filter "DisplayName like '$ServiceName'" `
-ErrorAction Stop
if ($Service) {Foreach ($ServiceInstance in $Service) {
SetOutput -Name $Computer.DNSHostname `
-Caption $ServiceInstance.Caption `
-State $ServiceInstance.state `
-Message $Null
$Output
} } else {}Catch {}
}