Querying A Named Instance From Powershell

Steve Jones explains how to query a named instance in Powershell:

I was looking at some sample code the other day and it looked like this.

cd sqlserver:\sql\localhost\default\databases

This allows you to browse the list of databases on your local instance. However, this is for a default instance, which I don’t have on this host. How can I get to a named instance? Usually I connect as .\SQL2016, so where does that fit in PowerShell?

Read on for the answer.

Related Posts

Unioning Sets with Powershell

Shane O’Neill gives us a rundown of unions in Powershell: For me, it summed down to “Is there something like UNION or UNION ALL in PowerShell? Luckily, this is something that I had asked before and been told the answer. So here I am, repeating the answer for you all since this is how I learn; repetition and practice. […]

Read More

Extracting ISPAC Files From the SSIS Catalog

Aaron Nelson shows how we can use Powershell to export ISPAC files from the SSIS catalog: You’ll notice with the code below, that we’re able to extract that Project-object into a variable named $Proj, but when we pipe that to the Get-Member cmdlet we do not see a method called Export. Read on to learn […]

Read More

Categories

January 2017
MTWTFSS
« Dec Feb »
 1
2345678
9101112131415
16171819202122
23242526272829
3031