Hi ,
I am trying to connect to SRM server from Powercli but getting below error.
PowerCLI D:\Scripts> Connect-SrmServer srmservername
Connect-SrmServer : Unable to connect to the remote server
At line:1 char:18
+ Connect-SrmServer <<<< srmservername
+ CategoryInfo : NotSpecified: (:) [Connect-SrmServer], WebExcept
ion
+ FullyQualifiedErrorId : System.Net.WebException,VMware.VimAutomation.ViC
ore.Cmdlets.Commands.Srm.ConnectSrmServer
PowerCLI D:\Scripts>
Could you please help me to know how to connect?
resolved , it was port 9007 blocked on firewall. When i checked the above error again i found that port 9007 is used.
Thanks all for the help
Hi
Have you connect to the vCenter Server system that the SRM server is registered with?
Check these links:
PowerCLI 5.5 R2 and the Site Recovery Manager API | VMware vSphere Blog - VMware Blogs
vSphere 5.5 Documentation Center - Connect to an SRM Server
Thanks Bayu for the reply,
Yes I 1st connect to VCenter server and then use connect-srmserver to connect to srm server. but still getting the error.
Have a look at Re: PowerCli SRM ListAssociatedVms throwing The Operation is not support on this Object
It links to an excellent blog post on the subject.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
HI Luc,
I tried below and still getting error, not sure what i am missing
PowerCLI C:\> $srm = Connect-SrmServer -RemoteUser 'domain\username -R
emotePassword 'password'
Connect-SrmServer : 6/21/2014 7:25:10 AM Connect-SrmServer No credent
ials to the local SRM were supplied.
At line:1 char:25
+ $srm = Connect-SrmServer <<<< -RemoteUser 'domain\username' -Remote
Password password
+ CategoryInfo : NotSpecified: (:) [Connect-SrmServer], VimExcept
ion
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomatio
n.ViCore.Cmdlets.Commands.Srm.ConnectSrmServer
this what i have tried till now, but no luck
PowerCLI C:\> $cred = Get-Credential
cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential
PowerCLI C:\> Connect-SrmServer -Credential $cred -RemoteCredential $cred
Connect-SrmServer : 6/21/2014 12:53:24 PM Connect-SrmServer Unable to
connect to the remote server
At line:1 char:18
+ Connect-SrmServer <<<< -Credential $cred -RemoteCredential $cred
+ CategoryInfo : NotSpecified: (:) [Connect-SrmServer], VimExcept
ion
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomatio
n.ViCore.Cmdlets.Commands.Srm.ConnectSrmServer
PowerCLI C:\> $srm = Connect-SrmServer
Connect-SrmServer : 6/21/2014 12:54:15 PM Connect-SrmServer Unable to
connect to the remote server
At line:1 char:26
+ $srm = Connect-SrmServer <<<<
+ CategoryInfo : NotSpecified: (:) [Connect-SrmServer], VimExcept
ion
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomatio
n.ViCore.Cmdlets.Commands.Srm.ConnectSrmServer
PowerCLI C:\> $srm = Connect-SrmServer -RemoteCredential $cred
Connect-SrmServer : 6/21/2014 12:55:13 PM Connect-SrmServer Unable to
connect to the remote server
At line:1 char:26
+ $srm = Connect-SrmServer <<<< -RemoteCredential $cred
+ CategoryInfo : NotSpecified: (:) [Connect-SrmServer], VimExcept
ion
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomatio
n.ViCore.Cmdlets.Commands.Srm.ConnectSrmServer
PowerCLI C:\>
This doesn't look like a credential error. More like a connectifity problem. Since you do not specify SRM server address, PowerCLI will use the SRM server address which is registered in VC. Is this address accesible from your PowerCLI machine? If you need to connect to SRM through a different interface, you can try and specify the address through the -SrmServerAddress parameter of Connect-SrmServer.
Also, look at
$exception = $error[0].Exception
$exception | select *
$exception.InnerException | select *
Also
$exception.StackTrace
$exception.InnerException.StackTrace.
Sometimes these can give you an idea what went wrong.
Hi George,
I am still getting error.
PowerCLI C:\> Connect-SrmServer -SrmServerAddress 10.xx.xx.xx
Connect-SrmServer : Unable to connect to the remote server
At line:1 char:18
+ Connect-SrmServer <<<< -SrmServerAddress 10.xx.xx.xx
+ CategoryInfo : NotSpecified: (:) [Connect-SrmServer], WebExcept
ion
+ FullyQualifiedErrorId : System.Net.WebException,VMware.VimAutomation.ViC
ore.Cmdlets.Commands.Srm.ConnectSrmServer
My SRM is registred in VC and i can connect to SRM from VC. I have another two VCs and there 2 SRM servers registered in each VC. there also i am getting same issue.
Can you try getting the extra error information (see comment #7). Note that you'll need to get $error[0] immediately after Connect-SrmServer fails.
If that doesn't work, the next stop is the Get-ErrorReport cmdlet. I'm not sure it intercepts SRM traffic but it's worth a try.
HI George,
Sorry for late reply, i was busy in some other stuff.
below is the error information
PowerCLI C:\> Connect-SrmServer -Credential $cred -RemoteCredential $cred
Connect-SrmServer : 7/23/2014 10:16:15 AM Connect-SrmServer Unable to
connect to the remote server
At line:1 char:18
+ Connect-SrmServer <<<< -Credential $cred -RemoteCredential $cred
+ CategoryInfo : NotSpecified: (:) [Connect-SrmServer], VimExcept
ion
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomatio
n.ViCore.Cmdlets.Commands.Srm.ConnectSrmServer
PowerCLI C:\> $exception = $error[0].Exception
PowerCLI C:\> $exception | select *
ErrorId : Core_BaseCmdlet_UnknownError
ErrorCategory : NotSpecified
TargetObject :
RecommendedAction :
SessionId :
ConnectionId : /VIServer=scs_prod\sachin.kalkutki@vor-mtan-vc111:443/
Severity : Error
Message : 7/23/2014 10:16:15 AM Connect-SrmServer Unable to
connect to the remote server
Data : {ParameterValues}
InnerException : System.Net.WebException: Unable to connect to the remote se
rver ---> System.Net.Sockets.SocketException: A connection
attempt failed because the connected party did not properly
respond after a period of time, or established connection
failed because connected host has failed to respond 10.xxx.
xx.xx:9007
at System.Net.Sockets.Socket.DoConnect(EndPoint endPoint
Snapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint re
moteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean
connectFailure, Socket s4, Socket s6, Socket& socket, IPAd
dress& address, ConnectSocketState state, IAsyncResult asyn
cResult, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at VMware.VimAutomation.Srm.Views.SrmServiceInstance.Srm
LoginSites(String username, String password, String remoteU
sername, String remotePassword, String locale)
at VMware.VimAutomation.ViCore.Impl.V1.Srm.SrmComponentI
mpl.LoginToSrmServerAtBothSites(String username, SecureStri
ng password, String remoteUsername, SecureString remotePass
word, String locale, SrmClient srmClient)
at VMware.VimAutomation.ViCore.Impl.V1.Srm.SrmComponentI
mpl.ConnectSrmClient(String hostName, Int32 port, String pr
otocol, String username, SecureString password, String remo
teUsername, SecureString remotePassword, String locale)
at VMware.VimAutomation.ViCore.Impl.V1.Srm.RelatedSrmSer
viceImpl.<ConnectSrmServers>d__c.MoveNext()
at VMware.VimAutomation.ViCore.Cmdlets.Commands.Srm.Conn
ectSrmServer.DoWork(VIAutomation client, List`1 moList)
at VMware.VimAutomation.ViCore.Util10Ps.BaseCmdlet.BaseC
mdlet.DoWork(VIConnection connection, List`1 moList)
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.BaseCmdl
et.DoWorkEx(VIConnection connection, List`1 moList)
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.Connecti
onDispatchHelper.ExecuteRunlist(Dictionary`2 runlist, DoWor
kDelegate doWorkDelegate, UidDispatchHelper uidDispatchHelp
er, List`1 result)
TargetSite :
StackTrace :
HelpLink :
Source :
PowerCLI C:\> $exception.InnerException | select *
Status : ConnectFailure
Response :
Message : Unable to connect to the remote server
Data : {ConnectionId}
InnerException : System.Net.Sockets.SocketException: A connection attempt faile
d because the connected party did not properly respond after a
period of time, or established connection failed because conn
ected host has failed to respond 10.xx.xx.xx:9007
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSna
pshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remot
eEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean co
nnectFailure, Socket s4, Socket s6, Socket& socket, IPAddress&
address, ConnectSocketState state, IAsyncResult asyncResult,
Int32 timeout, Exception& exception)
TargetSite : Void SrmLoginSites(System.String, System.String, System.String
, System.String, System.String)
StackTrace : at VMware.VimAutomation.Srm.Views.SrmServiceInstance.SrmLog
inSites(String username, String password, String remoteUsernam
e, String remotePassword, String locale)
at VMware.VimAutomation.ViCore.Impl.V1.Srm.SrmComponentImpl
.LoginToSrmServerAtBothSites(String username, SecureString pas
sword, String remoteUsername, SecureString remotePassword, Str
ing locale, SrmClient srmClient)
at VMware.VimAutomation.ViCore.Impl.V1.Srm.SrmComponentImpl
.ConnectSrmClient(String hostName, Int32 port, String protocol
, String username, SecureString password, String remoteUsernam
e, SecureString remotePassword, String locale)
at VMware.VimAutomation.ViCore.Impl.V1.Srm.RelatedSrmServic
eImpl.<ConnectSrmServers>d__c.MoveNext()
at VMware.VimAutomation.ViCore.Cmdlets.Commands.Srm.Connect
SrmServer.DoWork(VIAutomation client, List`1 moList)
at VMware.VimAutomation.ViCore.Util10Ps.BaseCmdlet.BaseCmdl
et.DoWork(VIConnection connection, List`1 moList)
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.BaseCmdlet.
DoWorkEx(VIConnection connection, List`1 moList)
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ConnectionD
ispatchHelper.ExecuteRunlist(Dictionary`2 runlist, DoWorkDeleg
ate doWorkDelegate, UidDispatchHelper uidDispatchHelper, List`
1 result)
HelpLink :
Source : VMware.VimAutomation.Srm.Views
resolved , it was port 9007 blocked on firewall. When i checked the above error again i found that port 9007 is used.
Thanks all for the help