5
votes

I right click an SQL server database MyDB in SSMS and select "start powershell". However, I got the following error. And it's quite slow?

WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on 'MyServer' failed with the following error: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
cd : SQL Server PowerShell provider error: Could not connect to 'MyServer\MyDB'. [Failed to connect to server MyServer\MyDB.

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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]

At line:1 char:155
+ ... MyServer\MyDB'']/Database[@Name=''MyDB'']'|cd}
+ ~~
+ CategoryInfo : OpenError: (SQLSERVER:\SQL...s\MyDB:SqlPath)[Set-Location], GenericProviderException
+ FullyQualifiedErrorId: ConnectFailed,Microsoft.PowerShell.Commands.SetLocationCommand

cd : SQL Server PowerShell provider error: Could not connect to 'MyServer\MyDB'. [Failed to connect to server MyServer\MyDB.

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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]

At line:1 char:155
+ ... MyServer\MyDB'']/Database[@Name=''MyDB'']'|cd}
+ ~~
+ CategoryInfo : OpenError: (SQLSERVER:\SQL...RTING\Databases:SqlPath) [Set-Location], GenericProviderException
+ FullyQualifiedErrorId: ConnectFailed,Microsoft.PowerShell.Commands.SetLocationCommand

cd : SQL Server PowerShell provider error: Could not connect to 'MyServer\MyDB'. [Failed to connect to server MyServer\MyDB.

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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]
At line:1 char:155
+ ... MyServer\MyDB'']/Database[@Name=''MyDB'']'|cd}
+ ~~
+ CategoryInfo : OpenError: (SQLSERVER:\SQL...1\MyDB:SqlPath) [Set-Location], GenericProviderException
+ FullyQualifiedErrorId : ConnectFailed,Microsoft.PowerShell.Commands.SetLocationCommand

1
Hi, is the server name MyServer and the DB name MyDB?sodawillow
Yes, they are not entered manually.ca9163d9
Did you configure your server to allow remote connections ? If not, take a look here stackoverflow.com/a/18060818/5212566Prageeth Saravanan
@prageeth the ssms can connect the server remotely.ca9163d9
Maybe a dumb question but is it running as admin?Sid

1 Answers

0
votes

Right-click on SSMS icon and select 'Run as Administrator'. Running SSMS as Administraotr also run Powershell with administrator privileges.