SHamel5575
Enthusiast
Enthusiast

Powercli Prompting for Creds

Jump to solution

we are upgrading from 5.5 to 6.5 and i am doing some powercli testing.   When i connect to the new 6.5 vcsa vcenter it prompts me for credentials.  I have joined the external PSC to the domain and i am using AD for authentication.  The account running powercli is an ad account with admin privledges in vcenter.  How do i fix this so my scheduled scripts will work?

Thanks.

1 Solution

Accepted Solutions
SHamel5575
Enthusiast
Enthusiast

Ok after a bunch of searching i found my answer.    

We have the PSC and vCenter Split on separate boxes.  The PSC was joined to the domain and setup for authentication against the domain.    It seems the vCenter Server, also needs to be Joined to the domain.  This can only be done via command line /opt/likewise/bin/domainjoin-cli join [domain] [user name]   After joining to the domain and  rebooting Powercli is passing credentials and longer prompting for credentials.  (when running the script with an ad user account with the appropriate permissions.) 

Please note before joining to the domain make sure you don’t have old DNS entries sharing the same IP as your vCenter.  There is a chance that your VC will pull its name from this old record.  To fix that i had to dis-join and reboot a few times, then re join to the domain.

I would like to thank aaronwsmith it was his post on this thread that eventually fixed my problem

View solution in original post

5 Replies
BPK2
Enthusiast
Enthusiast

Hi,

Check this below link. It may helps to you.

https://www.vmguru.com/2015/11/powershell-friday-connecting-to-vcenter/

-Praveen

0 Kudos
SHamel5575
Enthusiast
Enthusiast
That was not what i was looking for.  Im scheduling scripts and i dont want to hard code credentials on them.   Previously the script was running as an AD account that has permissions in vsphere, and i would not get prompted for credentials.  after building a 6.5 vcsa i am now prompted even though im running the script as a user that has access. 
0 Kudos
LucD
Leadership
Leadership

Could it be that you had CredentialStoreItems defined for the old vCenter?
Does it still prompt for credentials when you create them with New-VICredentialStoreItem for the new vCenter.

Note that you have to create them with the same AD account and on the same computer where you run the scripts.

See also Scripted Connect-VIServer prompts for credentials when connecting to vCenter 6.5 Appliance


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
SHamel5575
Enthusiast
Enthusiast

Ok after a bunch of searching i found my answer.    

We have the PSC and vCenter Split on separate boxes.  The PSC was joined to the domain and setup for authentication against the domain.    It seems the vCenter Server, also needs to be Joined to the domain.  This can only be done via command line /opt/likewise/bin/domainjoin-cli join [domain] [user name]   After joining to the domain and  rebooting Powercli is passing credentials and longer prompting for credentials.  (when running the script with an ad user account with the appropriate permissions.) 

Please note before joining to the domain make sure you don’t have old DNS entries sharing the same IP as your vCenter.  There is a chance that your VC will pull its name from this old record.  To fix that i had to dis-join and reboot a few times, then re join to the domain.

I would like to thank aaronwsmith it was his post on this thread that eventually fixed my problem

SHamel5575
Enthusiast
Enthusiast
I also need to make my vcenter connection using FQDN for this to work.
0 Kudos