PowerCLI

 View Only
  • 1.  Determine if PowerCLI is installed

    Posted Jul 22, 2009 10:22 PM

    I would like to make PowerCLI a pre-requisite for our product. How can I determine if it is installed and that the correct version is installed?

    I can easily check for Registry settings and that would be the preferred way.

    I've searched for PowerCLI in the registry to no avail. I've checked the basics under HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc. and there isn't anything that jumps out at me.



  • 2.  RE: Determine if PowerCLI is installed

    Posted Jul 22, 2009 10:43 PM

    Can't you use the Get-PSSnapin cmdlet to see if it is installed followed by the Get-ViToolkitVersion for the build version ?

    This of course presumes you do the tests from a PowerShell script.



  • 3.  RE: Determine if PowerCLI is installed

    Posted Jul 22, 2009 10:52 PM

    Can't you use the Get-PSSnapin cmdlet to see if it is installed followed by the Get-ViToolkitVersion for the build version ?

    This of course presumes you do the tests from a PowerShell script.

    I'll be in a process where I'm determining if things are installed before installing. So, I will be determining if PowerShell is installed as well (it may not be). So I would rather not attempt to shell out to a process that may not start and deal with the error handling. I would rather do a less "dangerous" scenario of examining the registry, file system, etc... It is a more consistent way of determining application install status.



  • 4.  RE: Determine if PowerCLI is installed
    Best Answer

    Posted Jul 22, 2009 11:01 PM

    Then you could test for the existance of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware vSphere PowerCLI.

    The branch contains a value (REG-SZ) called InstalledVersion.

    But the build number in there is not the one you will get with the Get-ViToolkitVersion cmdlet.

    It corresponds with the File Version property of the DLLs in the folder %ProgramFiles%\VMware\Infrastructure\vSphere PowerCLI.

    Note that this folder was called differently when the product was still called the VI Toolkit for Windows.