2

我正在研究使用 SQLPS 模块;PowerShell 3.0 版。运行Get-SqlInstance时,我一直收到以下错误。

PS 11/16/2015 08:34:29> $cred = Get-Credential
cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:

PS 11/16/2015 08:44:28> $instance = Get-SqlInstance -MachineName SM1208 -Credential $cred
Get-SqlInstance : The operation failed on target server 'SM1208'. Verify that the target server is accessible and that the SQL Server 
Cloud Adapter service is running.
At line:1 char:13
+ $instance = Get-SqlInstance -MachineName SM1208 -Credential $cred
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ResourceUnavailable: (SM1208:String) [Get-SqlInstance], SqlPowerShellRemoteOperationFailedException
+ FullyQualifiedErrorId : RemoteOperationFailedError,Microsoft.SqlServer.Management.PowerShell.IaaS.GetSqlInstanceCommand

我已经尝试过使用 localhost、IP 和另一个托管 SQL Server 实例的服务器。还使用 -Name 来指定实例名称。每次都是同样的错误。SQL Server 实例正在主机上运行。

PS 11/16/2015 08:44:55> Get-ExecutionPolicy
RemoteSigned

有任何想法吗?谢谢

4

2 回答 2

1

根据错误并由 OP 确认,目标主机上似乎缺少所需的服务:

Verify that (...) SQL Server Cloud Adapter service is running.

于 2015-11-17T16:32:06.727 回答
0

尝试:Get-Item SQLSERVER:\SQL\machinename\instancename

于 2021-10-21T12:29:32.327 回答