Get-SqlInstance:目标服务器上的操作失败

时间:2015-11-16 17:43:37

标签: powershell sqlps

我正在研究使用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

有什么想法吗?感谢

1 个答案:

答案 0 :(得分:1)

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

  

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