as900w
Hot Shot
Hot Shot

Get full name of VM using Get-VM command

Jump to solution

When name of the VM is a long, use get-vm command to get VM name that show ... after VM name.

1.PNG

I want to show full name of VM, What should I do?

1 Solution

Accepted Solutions
asajm
Expert
Expert

Hi as900w

Check How do I get Virtual Machine Name Output from 'Get-VM | Get-AdvancedSetting' command?

If you think your queries have been answered
Marking this response as "Solution " or "Kudo"
ASAJM

View solution in original post

0 Kudos
4 Replies
asajm
Expert
Expert

Hi as900w

Check How do I get Virtual Machine Name Output from 'Get-VM | Get-AdvancedSetting' command?

If you think your queries have been answered
Marking this response as "Solution " or "Kudo"
ASAJM
0 Kudos
RoderikdeBlock
Enthusiast
Enthusiast

Hi,    

This will do it for you:

Get-VM | ft -AutoSize

Roderik de Block


Blog: https://roderikdeblock.com
scott28tt
VMware Employee
VMware Employee

Moderator: Moved to PowerCLI


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMTN voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
0 Kudos
Lewa5VCP
Contributor
Contributor

get-vm |%{ $_|Select Name,@{N="OriginalName";E={(($_ | Get-AdvancedSetting |Where{$_.Name -eq 'nvram'} ).value).Split('.')[0]}}, VMHost,PowerState }

The above snippet should work, in case where the VM has been renamed after deployment. In such case the 'Name' attribute obtained from get-vm  cmdlet will be misleading, hence the above should be close to name used during original deployment.

0 Kudos