HI All,
When i'm trying to run the vCheck as batch file, but it still promoting for credential though i have stored the credential using the command.
New-VICredentialStoreItem -Host USvc1 -User domain\myvmk -Password Password@123
Thanks
V
Ok, that means the credential issue is solved.
Rests the error message.
I suspect that your PowerCLI installation might be corrupt.
To confirm that, can you do the following
Does that return your ESXi nodes without an error?
If it does, the next step I would like to try is to remove your current PowerCLI version completely.
Is this on the 11.3 station or on the 6.5 R1 station?
Pick one.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
How did you configure the vCenter in 00 Connection Plugin for vCenter.ps1 ?
Is there a line with $Server?
Did you assign the same value as you used on the Host parameter in the New-VICredentialStoreItem?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
Just to brief more on this. As i mentioned in earlier thread, i'm trying to pull the VM list deleted and created from last 5 days. I have disabled all other plugin using select plugin.
I can run the vcheck manually and it send me mail for VM deleted andcreated.
Now coming to your questions:-
How did you configure the vCenter in 00 Connection Plugin for vCenter.ps1 ?
Is there a line with $Server? Yes, please see screen shot above.
Did you assign the same value as you used on the Host parameter in the New-VICredentialStoreItem? yes, Hope you mean same value as vcenter name as host.
Thanks
V
From what you shared it looks as if you used the 'short' hostname of the vCenter on the New-VICredentialStoreItem and the FQDN in the plugin.
You have to either use the short name or the FQDN on both.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD,
You might be right but i used FQDN both the places and now i tried to remove the credential so that i can use new host as FQDN
Thanks
V
For the Remove-VICredentialSToreItem you only need to pass the Host and User
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Bad luck this option as well. Still prompting for credential after storing password again. Also, i tried from different work station as well but still same result i.e. prompting for credential.
Any other ideas how to fix this ?
Thanks
V
I would need to look in detail at your files, and how you configured/updated them.
There are at least 2 files that are important: globalvariables.ps1 and 00 Connection Plugin for vCenter.ps1
Some observations:
- looks like you are using an older PowerCLI version. Newer version don't have that customised window/prompt anymore
- when you showed a screenshot of 00 Connection Plugin for vCenter.ps1 there seem to be <CR><LF> missing
- why are you starting the vCheck.ps1 script from a CMD? Is it working when you just run vCheck.ps1 from a PowerShell prompt?
- just to make sure, the account under which you ran the New-VICredentialStoreItem cmdlet is the same that you use to run vCheck.ps1?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
Please answer to your questions.
Some observations:
- looks like you are using an older PowerCLI version. Newer version don't have that customised window/prompt anymore
PowerCLI Version
----------------
VMware PowerCLI 11.3.0 build 13990089
---------------
Component Versions
---------------
VMware Cis Core PowerCLI Component PowerCLI Component 11.3 build 13964830
VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 11.3 build 13964826
- when you showed a screenshot of 00 Connection Plugin for vCenter.ps1 there seem to be <CR><LF> missing - I have attached the plugin after changing the vc name.
- why are you starting the vCheck.ps1 script from a CMD? Is it working when you just run vCheck.ps1 from a PowerShell prompt? - Yes, its prompt and it throws an error
PS D:\abc\VM_DC> .\vCheck.ps1
WARNING:
WARNING: Welcome to vCheck by Virtu-Al http://virtu-al.net
WARNING: =================================================
WARNING: This is the first time you have run this script or you have re-enabled the setup wizard.
WARNING:
WARNING: To re-run this wizard in the future please use vCheck.ps1 -Config
WARNING: To get usage information, please use Get-Help vCheck.ps1
WARNING:
WARNING: Please complete the following questions or hit Enter to accept the current setting
WARNING: After completing this wizard the vCheck report will be displayed on the screen.
WARNING:
WARNING:
Begin Plugin Processing
[03:40:25] ..start calculating Connection settings for vCenter by Alan Renouf v1.20 [1 of 3]
Get-VMHost : 5/28/2020 3:40:31 AM Get-VMHost Sequence contains more than one matching element
At D:\abc\VM_DC\Plugins\00 Initialize\00 Connection Plugin for vCenter.ps1:204 char:8
+ $VMH = Get-VMHost | Sort-Object Name
+ ~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-VMHost], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVMHost
Get-Cluster : 5/28/2020 3:40:32 AM Get-Cluster Sequence contains more than one matching element
At D:\abcVM_DC\Plugins\00 Initialize\00 Connection Plugin for vCenter.ps1:206 char:13
+ $Clusters = Get-Cluster | Sort-Object Name
+ ~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-Cluster], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetCluster
Get-Datastore : 5/28/2020 3:40:32 AM Get-Datastore Sequence contains more than one matching element
At D:\abc\VM_DC\Plugins\00 Initialize\00 Connection Plugin for vCenter.ps1:208 char:15
+ $Datastores = Get-Datastore | Sort-Object Name
+ ~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-Datastore], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetDatastore
[03:41:01] ..finished calculating Connection settings for vCenter by Alan Renouf v1.20 [1 of 3]
[03:41:01] ..start calculating Created or cloned VMs by Alan Renouf v1.3 [2 of 3]
Get-Folder : 5/28/2020 3:41:01 AM Get-Folder Sequence contains more than one matching element
At D:\abc\VM_DC\Plugins\00 Initialize\00 Connection Plugin for vCenter.ps1:332 char:22
+ $Entity = @(Get-Folder -NoRecursion)
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-Folder], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetFolder
[03:41:01] ..finished calculating Created or cloned VMs by Alan Renouf v1.3 [2 of 3]
[03:41:02] ..start calculating Removed VMs by Alan Renouf v1.4 [3 of 3]
Get-Folder : 5/28/2020 3:41:02 AM Get-Folder Sequence contains more than one matching element
At D:\abc\VM_DC\Plugins\00 Initialize\00 Connection Plugin for vCenter.ps1:332 char:22
+ $Entity = @(Get-Folder -NoRecursion)
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-Folder], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetFolder
[03:41:02] ..finished calculating Removed VMs by Alan Renouf v1.4 [3 of 3]
[03:41:03] ..Displaying HTML results
[03:41:03] ..Sending Email
PS D:\abc\VM_DC> .\multi-vc.ps1
- just to make sure, the account under which you ran the New-VICredentialStoreItem cmdlet is the same that you use to run vCheck.ps1? - Yes.
Also, when i use the older power cli version
PowerCLI Version
----------------
VMware PowerCLI 6.5 Release 1 build 4624819
It prompts me for credential, but i'm able to successfully able to excute the vcheck.ps1
Are you saying that you have 2 PowerCLI versions (11.3 and 6.5 R1) on that station?
That will not work.
The 6.5 R1 version is a version that is installed with an MSI file, later versions are installed from the PSGallery.
These versions can not co-exist!
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
No, LucD, i have two workstation with different version.
Ok.
There are 2 issues (as I see it)
- the error 'Sequence contains more than one matching element'
- the credential prompt
For the error:
Do you have more than 1 vCenter?
If yes, do you get that same error on all vCenters? Or just a specific one?
For the credentials:
For one reason or the other, the CRedentialStoreItem doesn't seem to pick up the entry for the vCenter.
Can you try to remove the credentialstore file (normally that file is %APPDATA%\VMware\credstore\vicredentials.xml) manually.
And then create a new file with the New-VICredentialStoreItem cmdlet.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
You are right
For the error:
Do you have more than 1 vCenter? Yes, its in linked mode. (VC1/VC2/VC3/VC4) Any issue having linked mode since i'm running the vCheck on specific vCenter only.
If yes, do you get that same error on all vCenters? Or just a specific one? I need to try in other VC as well. I'll updated shortly.
For the credentials: Will try and update
For one reason or the other, the CRedentialStoreItem doesn't seem to pick up the entry for the vCenter.
Can you try to remove the credentialstore file (normally that file is %APPDATA%\VMware\credstore\vicredentials.xml) manually.
And then create a new file with the New-VICredentialStoreItem cmdlet.
LucD,
I tried after removing the credstore file, but still same result. It appears due to linked mode as per my understanding.
Thanks
V
To be honest I never heard of issues with vCenters in linked-mode and Connect-VIServer.
What about that other error ('Sequence contains more than one matching element').
Do you get that on all vCenters?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
What about that other error ('Sequence contains more than one matching element').
Do you get that on all vCenters? Yes on all vCenter for Power Cli ver 11.3.0, but not powercli version 6.5. From Power Cli 6.5 it run successfully but as i said credential is prompted for both version.
PowerCLI Version
----------------
VMware PowerCLI 11.3.0 build 13990089
Thanks
V
If you do a simple Connect-VIServer -Server <your-server> from the PS prompt, do you also get prompted for credentials?
For all your vCenters?
In both PowerCLI versions?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LuCD,
You asked a valid question which i skipped earlier in mail thread. Connect-VIServer -Server <your-server> - User - Password below errors throws. But when i use without password parameter then it connect successfully but it prompts for credential windows in both the case.
For all your vCenters? - Yes
Connect-VIServer -Server <your-server> see screenshot
This is becoming confusing :smileygrin:
So when you connect with a User and Password, you get that 'Cannot complete login' error?
When you leave out the password, the connection works?
Do you have more than 1 VICredentialStoreItem for your vCenter?
What is returned when you do
Multiple entries?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
This is becoming confusing
So when you connect with a User and Password, you get that 'Cannot complete login' error? Yes
When you leave out the password, the connection works? No, it will prompt for credential windows and once you input the user id and password it will connect in both the case of power cli version.
Do you have more than 1 VICredentialStoreItem for your vCenter? - 2 vc,but i can see only xml file in credstore path.
What is returned when you do
Get-VICredentialStoreItem -Host <your-vcenter>
Multiple entries?
Thanks
V