Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Remotely executing an invoke-sqlcmd fails

$
0
0

When remotely executing an invoke-sqlcmd fails.  A simple query such as:

Invoke-Command -ComputerName ComputerName -ScriptBlock{
$qry = "SELECT SERVERPROPERTY('ServerName') AS ServerName,
   SERVERPROPERTY('ProductVersion') AS ProductVersion,
   SERVERPROPERTY('ProductLevel') AS ProductLevel,
   SERVERPROPERTY('Edition') AS Edition, 
   SERVERPROPERTY('EngineEdition') AS EngineEdition;" 
   Invoke-Sqlcmd -Query $qry} -ConfigurationName SQLSession

I get the following error:

[ComputerName] Connecting to remote server failed with the following error message : The WS-Management service cannot process the request. The resource URI (http://sche
mas.microsoft.com/powershell/SQLSession) was not found in the WS-Management catalog. The catalog contains the metadata that describes resources, or logical endpoints. For 
more information, see the about_Remote_Troubleshooting Help topic.+ CategoryInfo          : OpenError: (:) [], PSRemotingTransportException+ FullyQualifiedErrorId : PSSessionStateBroken

I have run Enable-WSManCredSSP Server on the SQL server and  tried to run Enable-WSManCredSSP -Role Client -DelegatedCredentials * on a Windows 7 x32 workstation but I get the following error:

Enable-WSManCredSSP : A parameter cannot be found that matches parameter name 'DelegatedCredentials'.
At line:1 char:55+ Enable-WSManCredSSP -Role Client -DelegatedCredentials <<<<  *+ CategoryInfo          : InvalidArgument: (:) [Enable-WSManCredSSP], ParameterBindingException+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.WSMan.Management.EnableWSManCredSSPCommand
I have tried the Enable-WSManCredSSP with the actual server name instead of a wildcard and it still fails.

Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>