VMware Cloud Community
oliver_g
Enthusiast
Enthusiast

PowerCLI

Hello Members,

I am using PowerCLI to create, delete, and check snapshots on a series of vms.

Some on Vcenter server and some on standalone hosts.

The vCenter servers are not on a domain.

for some reason (as yet unknown to me) I cannot used this to connect to the vCenter servers:

Connect-VIServer -Server "ip addr" -User vmuser@vsphere.local -Password vmuserpassword

This fails in a ps1 script, and fails if I run it from the PowerCLI command line.

I can log in with these creds through the vsphere client.

Any clues on getting the credentials to work?

Thanks,

Olliver g

0 Kudos
6 Replies
KocPawel
Hot Shot
Hot Shot

Any error messages?Can you take a screenshot or something?

0 Kudos
daphnissov
Immortal
Immortal

Wrong sub-forum. Please move to PowerCLI.

0 Kudos
Gidrakos
Hot Shot
Hot Shot

Try storing your credentials in a variable and pass that along, rather than sending the password in plain text.

$cred = Get-Credential

Connect-ViServer -credential $cred

0 Kudos
vkernelblog
Contributor
Contributor

Hi Oliver g,

As mentioned above, you should add you credentials in a plain text format.

There are two ways to secure your login:

Option 1: add get-credentials in a variable that you could use in your script.

Option 2: ViCredentialstoreItem. This is a secure credential store from PowerCLI. Read more: Have you seen PowerCLI's "Credential Store" feature? - VMware PowerCLI Blog - VMware Blogs

If you need any help with it, just let me know.

0 Kudos
scott28tt
VMware Employee
VMware Employee

Moderator: Moved to PowerCLI


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
0 Kudos
LucD
Leadership
Leadership

Can you show the full error message you are getting?


There are a couple of things you might want to check:

  • Are you using a recent PowerCLI version?

          Get-Module -Name VMware.PowerCLI -ListAvailable

  • Did you set the PowerCLI configuration to ignore invalid certificates?

         

          Set-PowerCLIConfiguration -InvalidCertificateAction Ignore

  • Is the TLS setting corresponding with the one you have on the vCenter? Try this before the Connect-VIServer

          [System.Net.ServicePointManager]::SecurityProtocol =  [System.Net.SecurityProtocolType]'Tls,Tls11,Tls12'


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

0 Kudos