Get-ChildItem fails to connect in SQLSERVER drive

Posted by Norman Kelm on Server Fault See other posts from Server Fault or by Norman Kelm
Published on 2010-11-27T15:07:03Z Indexed on 2011/01/29 7:28 UTC
Read the original article Hit count: 554

Filed under:
|

I'm having some trouble with the SQLSERVER PSDRIVE. See error below.

I only have named instances on my PC, both 2005 and 2008

Added the SQL snapins.

The PC is named YODA The SQL instance is SQL2008 Navigate to the Databases folder for YODA\SQL2008. You can see the path below. dir -name spits out a connection error trying to connect to YODASQL2008\DEFAULT when it should be trying to connect to YODA\SQL2008. Then it outputs the db name which is Twitter in this case. Is there something missing from my config?

Output: PS SQLSERVER:\SQL\YODA\SQL2008\Databases> dir -name
Get-ChildItem : SQL Server PowerShell provider error: Could not connect to 'YODASQL2008\DEFAULT'. [Failed to connect to server YODASQL2008. --> A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]

At line:1 char:4
+ dir <<<<  -name
    + CategoryInfo          : OpenError: (SQLSERVER:\SQL\...tabases\Twitter:SqlPath) [Get-ChildItem], GenericProviderException
    + FullyQualifiedErrorId : ConnectFailed,Microsoft.PowerShell.Commands.GetChildItemCommand Twitter

Repeats with error for every database.

Thanks, Norman

© Server Fault or respective owner

Related posts about sql-server

Related posts about powershell