0

I have only a hostname (what Microsoft calls a COMPUTERNAME). How can I get the names of SQL Server instances running on the host?

It appears from other answers that I could look through the services running on the host. However, it is a remote machine and I am not an Administrator for the host or any of the database instances. The organization has not begun to use PowerShell remoting.

Is there a better way? How can this be done?

Windows PowerShell

PS C:\> Get-Service -ComputerName Tyyyyyyy8B
Get-Service : Cannot open Service Control Manager on computer 'Tyyyyyyyy8B'. This operation might require other
privileges.
At line:1 char:1
+ Get-Service -ComputerName Tyyyyyyy8B
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-Service], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.GetServiceCommand

PS C:\> $PSVersionTable.PSVersion.ToString()
5.1.19041.2364

PowerShell Core

PS C:\> Get-Service -ComputerName Tyyyyyyy8B
Get-Service: A parameter cannot be found that matches parameter name 'ComputerName'.
PS C:\> $PSVersionTable.PSVersion.ToString()
7.3.5

...why not ask an admin or DBA for help?

I am a mere, lowly user. There is significant organizational resistance to making work requests of another group.


What is the minimum set of permissions I would need to ask for in order to discover SQL Server instances?

0

1 Answer 1

1

However, it is a remote machine

  1. You don't need to remote to server to get list of services just run

    Get-Service -ComputerName yourserver
    

    However, you need some permissions on the server to get this list.

    Problem - service names don't always follow naming standards for all versions.

  2. Ask the registry on the remote computer using RegistryKey.OpenRemoteBaseKey


From Getting remote services:

Starting in PowerShell 6.0, the *-Service cmdlets don't have the ComputerName parameter. You can still get services on remote computers with PowerShell remoting.

Point 2 above is not VB function; it's another way to query the server based on registry or in your case remote registry

What is the minimum, specific permission(s) I should ask the AD/security people to grant in order do see the services on a machine?

READ_CONTROL

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.