VMware Cloud Community
hanslammerts
Contributor
Contributor
Jump to solution

Powershell / PowerCLI on Linux

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

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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....)


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

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

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....)


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

0 Kudos
LucD
Leadership
Leadership
Jump to solution

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


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

0 Kudos
hanslammerts
Contributor
Contributor
Jump to solution

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

0 Kudos