Month: April 2018

  • PowerCLI: Import-vApp OVA: Hostname cannot be parsed.

    The other day I was rebuilding my lab using William Lam’s vGhetto vSphere Automated Lab Deployment script for vSphere 6.5. In the past I have run the 6.0 script successfully. As part of the script, there is an OVA of a host profile that William has made for the deployment, this is used for the configuration of the host.
    This particular time I came across an error right after starting the process and immediately after connecting to the nesting host.  It was a bit of a strange error, pointing to the Import-vApp cmdlet but also saying, “Invalid URI: The hostname could not be parsed,” which sounded as though to be a DNS issue, I spent a little bit of time going through my DNS settings, making sure that the computer from which I was running the script was able to resolve the hostname. I moved off my MacBook using PowerCLI Core and tested from my Windows machine using PowerCLI 10.0, and received the same error.

    I did some quick research and found nothing related to the specific error message and started to look at it piece by piece. I decided to pull apart the OVA file and try and run just the OVF – SUCCESS! There appears to be an issue with the OVA and the Import-vApp cmdlet in both PowerCLI Core and PowerCLI 10.0. I am yet to test the OVA in vSphere via the WebClient, but I suspect it may work as it should.

    To pull apart the OVA, I recommend using 7ZIP and opening the .ova file and copy/paste the content.

    1. Download and Install 7ZIP
    2. Relaunch explorer
    3. right click OVA file -> 7ZIP -> extract to /<foldername>
    4. check for the VMDK, OVF and description file are all present
    5. Change your ESXI $NestedESXiApplianceOVA= to the .ovf file
    6. rerun script.
  • Configure PowerCLI and PowerNSX on macOS

    A couple of months back, PowerShell Core on Mac and Linux became mainstream after success of its beta. This has allowed for modules to be extended to also be cross-platform for many products out there. The two main products I want to cover are the PowerCLI and PowerNSX and installing from the Powershell Gallery.
    To get started, you will need to go to the PowerShell github repo and download the PowerShell install package that is right for your system.
    Once the package is installed, Open up terminal and type pwsh to launch PowerShell.
    The next Module you will need to install is PowerCLI 10.0 which is the full feature install.
    In your PS terminal, insert the below

    PS>Install-Module -Name VMware.PowerCLI -Scope CurrentUser

    If you receive an invalid certificate error, you can bypass this by using the below.

    PS>Set-PowerCLIConfiguration -InvalidCertificateAction Ignore
    To confirm the Module is installed, you can run Get-Module VMware.PowerCLI 
    Lastly, you will want to install PowerNSX, there is whole site full of information regarding PowerNSX and how to use it, 
     
    The Easiest way to Install powerNSX is to run:
    PS>Install-Module PowerNSX
    PS>Import-Module PowerNSX
    Again, to confirm installation, run Get-Module and check if PowerNSX is listed.  You should something like below.
    Screen Shot 2018-04-06 at 12.39.20 am
    That’s it, PowerCLI and PowerNSX are now installed.
    To keep the versions up to date, you can run the Update-Module cmdlet.
    PS>Update-Module VMware.PowerCLI
    PS>Update-Module PowerNSX