Hi,
I am creating Automation scripts for our SRA. I am trying to do with Power CLI commands, using trying to manage SRM. Installed vCenter Power CLI 11.2. using powerCLI,
i am able to connect SRM servers, but discoverdevices() is failing. as per syntax arguments are not required. but the command failed as expecting some arguments.
below are process steps followed.
Appreciate your help to resolve
============================
PS C:\Users\Administrator> Connect-VIServer -server xxxx1202.sss.ccc.com -username Administrator@vsphere.local -password xxxxxxxx12#
Name Port User ---- ---- ---- xxxx1202.sss.ccc.com 443 VSPHERE.LOCAL\Administrator
PS C:\Users\Administrator> $srmConn=Connect-SrmServer -user Administrator@vsphere.local -password xxxxxxxx12# -RemoteUser Administrator@vsphere.local -RemotePassword xxxxxxxx12# -IgnoreCertificateErrors
PS C:\Users\Administrator> $srmapi=$srmConn.ExtensionData
PS C:\Users\Administrator> $srmapi.Storage.DiscoverDevices()
Exception calling "DiscoverDevices" with "0" argument(s): "The request refers to an unexpected or unknown type."
At line:1 char:1 + $srmapi.Storage.DiscoverDevices() + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : VimException
============================
Thanks
Noorullah
Could be that you are hitting a known issue with the SRM module that comes with PowerCLI 11.2.0.
See also Re: Connect-SrmServer fails when -RemoteCredential is used
Rolling back the SRM module to a 10.* version seems to have fixed the issue.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
i tried the same steps. but i am getting version mismatch error.
'VMware.VimAutomation.Srm.Views.Utils.VimClientDelayedResolveProxy' from assembly 'VMware.VimAutomation.Srm.Views, Version=10.0.0.1041, Culture=neutral,
PublicKeyToken=null' does not have an implementation.
Installed Modules:
Version Name Repository
------- ---- ----------
6.7.0.11233116 VMware.DeployAutomation PSRepository
6.7.0.11233116 VMware.ImageBuilder PSRepository
11.3.0.13990089 VMware.PowerCLI PSRepository
6.7.0.13964812 VMware.Vim PSRepository
11.3.0.13964830 VMware.VimAutomation.Cis.Core PSRepository
11.0.0.10379994 VMware.VimAutomation.Cloud PSRepository
11.3.0.13964816 VMware.VimAutomation.Common PSRepository
11.3.0.13964826 VMware.VimAutomation.Core PSRepository
11.3.0.13976786 VMware.VimAutomation.Hcx PSRepository
7.6.0.13827661 VMware.VimAutomation.HorizonView PSRepository
11.3.0.13990093 VMware.VimAutomation.License PSRepository
11.3.0.13964817 VMware.VimAutomation.Nsxt PSRepository
11.3.0.13964823 VMware.VimAutomation.Sdk PSRepository
11.0.0.10380515 VMware.VimAutomation.Security PSRepository
10.0.0.7893900 VMware.VimAutomation.Srm PSRepository
11.3.0.13976676 VMware.VimAutomation.Storage PSRepository
1.3.0.0 VMware.VimAutomation.StorageUtility PSRepository
11.2.0.12483615 VMware.VimAutomation.Vds PSRepository
11.3.0.13964814 VMware.VimAutomation.Vmc PSRepository
10.0.0.7893921 VMware.VimAutomation.vROps PSRepository
6.5.1.7862888 VMware.VumAutomation PSRepository
PS C:\Users\Administrator> Connect-SrmServer -server DLDVxxxx.xxx.xxx.com -username Administrator@vsphere.local -password xxxxx# -RemoteUser Administrator@vsphere.local -RemotePassword xxxxxx#
Connect-SrmServer : 6/20/2019 3:40:03 AM Connect-SrmServer Method 'LoginByBearerToken' in type
'VMware.VimAutomation.Srm.Views.Utils.VimClientDelayedResolveProxy' from assembly 'VMware.VimAutomation.Srm.Views, Version=10.0.0.1041, Culture=neutral,
PublicKeyToken=null' does not have an implementation.
At line:1 char:1
+ Connect-SrmServer -server DLDVxxxx.xxx.xxx.com -username Administrato ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-SrmServer], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.Srm.Commands.Commands.ConnectSrmServer
did you changed anything else. please tell me if i am missing something here.
I agree it was a long shot.
Perhaps time to open a SR?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I recently upgraded to PowerCLI 11.3 and started running into the same issues with "Unable to connect to the remote server". I thought it was related to 11.3 in particular, but when I went to the Module folder for SRM, I had two folders, one for a Version 10.x and one for 11.2
Get-Module VMware.VimAutomation.Srm -ListAvailable | Select ModuleBase
I went to the entire Module folder and deleted all of the VMware folders and installed the 11.0 version as a test
Install-Module -Name VMware.PowerCLI -RequiredVersion 11.0.0.10380590
With this I was able to connect to both SRM sites without error. I then upgraded through each release version and it continued working. I think ultimately there was a conflict with the two folders in the VMware.VimAutomation.Srm module folder and manually deleting all of the VMware modules and installing only the latest resolved the issue for me on two different computers.