This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

List SQL instance port

Hi,

I have a powershell script to list the SQL Server instance port that is fully functional on the server itself but that return nothing when executed by SAM. The server is monitored through a SolarWinds agent.

The script is:

$path = 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\*\MSSQLServer\SuperSocketNetLib\Tcp\IPAll'
$name = "TcpPort"
[array]$value = (Get-ItemProperty -Path $path -name $name)
$v = $value.TcpPort
Write-Host "Message: VALUE: $v"
write-host "Statistic: $($v.count)"

the output on the server is:

Message: VALUE: 54046 57782 57650 53162 53932 55822 60945 50526
Statistic: 8

The output from SAM is:

Message.Statistic: VALUE:

Statistic.Statistic: 0

I have try to execute the script with and without specifying an account.
Have you already have the need to gather this information and how do you have implemented it in SolarWinds ?
Any idea how to get this info, knowing that this info has to be an input for another part of the script.
Cheers