Hi,
I am getting the above mentioned error, I am able to connect to vCenter and I get this error
Script
Connect-VIServer 172.24.255.176
$srm = Connect-SrmServer
$srmApi = $srm.ExtensionData
$protectionGroups = $srmApi.Protection.ListProtectionGroups()
$protectionGroups | % {
$protectionGroup = $_
$protectionGroupInfo = $protectionGroup.GetInfo()
# The following command lists the virtual machines associated with a protection group
$protectedVms = $protectionGroup.ListProtectedVms()
# The result of the above call is an array of references to the virtual machines at the vSphere API
# To populate the data from the vSphere connection, call the UpdateViewData method on each virtual machine view object
$protectedVms | % { $_.Vm.UpdateViewData() }
# After the data is populated, use it to generate a report
$protectedVms | %{
$output = "" | select VmName, PgName
$output.VmName = $_.Vm.Name
$output.PgName = $protectionGroupInfo.Name
$output
}
} | Format-Table -auto @{N="VM Name";E={$_.VmName}}, @{N="Protection Group Name";E={$_.PgName}}
disconnect-viserver -server * -force -confirm:$false
Error :
Connect-SrmServer : 07/17/2019 7:02:35 AM | Connect-SrmServer | Cannot complete login due to an incorrect user name or password. |
At D:\DS\SG1.ps1:2 char:8
+ $srm = Connect-SrmServer
+ | ~~~~~~~~~~~~~~~~~ | |
+ CategoryInfo | : NotSpecified: (:) [Connect-SrmServer], VimException | |
+ FullyQualifiedErrorId : ConnectServer_UnhandledException,VMware.VimAutomation.Srm.Commands.Commands.ConnectSrmServer |
Could it be that entry in the CredentialStore for the vCenter specifies different credentials (another user) than the one in $vcuser?
Do a Get-VICrendtialStoreItem and check the user
---------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Could the 2nd paragraph in section Site Recovery Manager and the vCenter Server Administrator Role (page 11) in the SRM Administration Guide be applicable?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
Thanks for your reply.
I am able to connect to SRM, If I pass the credentials as below
connect-viserver 10.10.10.10 -username $vcuser -password $vcpass|out-null
Connect-SrmServer
But If I use as below, I am getting error, here I have saved my credentials using New-VICredentialStoreItem for storing credentials for vCenter
connect-viserver 10.10.10.10 |out-null
Connect-SrmServer
Could it be that entry in the CredentialStore for the vCenter specifies different credentials (another user) than the one in $vcuser?
Do a Get-VICrendtialStoreItem and check the user
---------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks a lot LucD,
I removed all the entries in VICrendtialStoreItem and re-added back, after which I am able to connect.