Automation

 View Only
  • 1.  PowerCLI

    Posted Oct 28, 2019 09:26 PM

    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



  • 2.  RE: PowerCLI

    Posted Oct 28, 2019 09:58 PM

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



  • 3.  RE: PowerCLI

    Posted Oct 28, 2019 10:08 PM

    Wrong sub-forum. Please move to PowerCLI.



  • 4.  RE: PowerCLI

    Posted Oct 29, 2019 03:41 PM

    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



  • 5.  RE: PowerCLI

    Posted Nov 28, 2019 07:58 AM

    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.



  • 6.  RE: PowerCLI

    Broadcom Employee
    Posted Nov 28, 2019 11:28 AM

    Moderator: Moved to PowerCLI



  • 7.  RE: PowerCLI

    Posted Nov 28, 2019 11:38 AM

    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'