26 June,2012 by Tom Collins
Question : I want to list the SQL Server Instances on a remote server. How can I do this with a Powershell script?
I've alread read List SQL Server Instances using Powershell and Get-ItemProperty for local registry search
Answer: Remote registry access with Powershell is about using a) the [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey Object b) the OpenRemoteBaseKey Method c) the GetValueNames method d) the OpenSubKey method
This is a simple example
$server = "myServer" $keypath = 'Software\Microsoft\Microsoft SQL Server\Instance Names\SQL' $roottype = "LocalMachine" $rootkey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($roottype,$server) $rootkey = $rootkey.OpenSubKey($keypath ) Foreach($instance in $rootkey.GetValueNames()){$instance}
List SQL Server Instances using Powershell and Get-ItemProperty
SQL Server – Send email using Powershell
SQL Server Version with Powershell
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |