A nother post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBlogger s.
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?
The format you see above is for the SQLServer provider, which is provided as part of the SQLServer PoSh module (or SQLPS if you haven’t adopted the new cmdlets).
If I start at the SQLServer:\ node, I see this:

Let’s drop into the SQL node and see that.

At this point, I see my localhost and my local computer name. These are really the same thing. We can see that by querying each of them.

In my case, I like to type fewer characters, so I’ll look at the Plato node. If I change here, I can also change to an instance, as shown here.

Now I can see the databases by changing to that path and getting the directory.

Thus, we can see that to query an instance, we use this path:
SQLServer:\SQL\Host\instance
If you want to use the default instance, then use “default”.
A simple query path, but one that some people might wonder about, substituting the named instance for localhost, and not realizing that “Default” means just the default instance.