Automation

 View Only
  • 1.  Powershell / PowerCLI on Linux

    Posted Apr 14, 2020 12:46 PM

    Hi,

    For now I'm writing and testing my PowerCLI scripts from a Linux machine (CentOS). This mostly works, apart from scripts where I need to use WMI or CMI objects.

    At this time we have a wish to map Windows driveletters to the corresponding VMDK files. I have seen a number of scripts that can do that, however they only work when running a PS /PowerCLI from a windows machine.

    Does anyone know if this can be achieved from a powershell/powercli script running on a Linux machine ?

    Alternatively, is there a way to check on what kind of platform you are running the script on, in order to gracefully abort the script with messages ?

    Thanks,

    Hans



  • 2.  RE: Powershell / PowerCLI on Linux
    Best Answer

    Posted Apr 14, 2020 12:52 PM

    To take away your expectations, there is no fool-proof way to map VMDK to guest OS partitions.

    Until PowerCLI 12.0, where the Get-VMGuestDisk cmdlet was introduced.

    This cmdlet works completely with the VMware Tools, no need for WMI, CMI or other exotic trickery.

    But be aware that the cmdlet has a few prerequisites (vSphere 7.*, VMware Tools 11....)



  • 3.  RE: Powershell / PowerCLI on Linux

    Posted Apr 14, 2020 12:54 PM

    For the 2nd part of your question, concerning the platform, the $PSVersionTable variable has a property PSEdition that will show where you are running.



  • 4.  RE: Powershell / PowerCLI on Linux

    Posted Apr 14, 2020 01:12 PM

    Thanks Luc,

     

    We just updated from 6.0 to 6.7, so another update to 7 will probably not happen anywhere soon.....

    I guess I will have to disappoint several collegues.....

    Thanks anyway, we'll decide what to do. I will mark this one as closed.

     

    Regards,

    Hans