none
How to find the GUID of a VM by using Powershell? RRS feed

  • Question

  • Hi all;

    Is there any Powershell cmdlet to list the GUIDs of VMs?

    Thanks


    Please VOTE as HELPFUL if the post helps you and remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Thursday, April 23, 2015 1:26 PM

Answers

  • You can use this syntax:

    Get-VM | format-list VMname, VMID


    Regards, Samir Farhat Infrastructure and Virtualization Consultant || Virtualization, Cloud, Azure ? Follow and Ask here https://buildwindows.wordpress.com

    • Marked as answer by R.Alikhani Thursday, April 23, 2015 2:40 PM
    Thursday, April 23, 2015 2:16 PM
  • Or a better output format

    Get-VM | Select-Object VMname, VMID


    Regards, Samir Farhat Infrastructure and Virtualization Consultant || Virtualization, Cloud, Azure ? Follow and Ask here https://buildwindows.wordpress.com

    • Marked as answer by R.Alikhani Thursday, April 23, 2015 2:40 PM
    Thursday, April 23, 2015 2:17 PM
  • Just to add some color to the answers you have:

    the Get-VM cmdlet filters the properties returned to a small but immediately useful set.  There are for more properties that each VM possesses.

    Try:

    Get-VM * | Select *

    This will show you all of the properties of all of your VMs


    Brian Ehlert
    http://ITProctology.blogspot.com
    Learn. Apply. Repeat.

    Thursday, April 23, 2015 2:47 PM
    Moderator
  • I forgot to tell you that you can list all the 'Get-VM' properties to use them in your command.

    Get-VM | Get-Member

    This will return you all the possible properties that you can select : Example : If you want to output the Name, VMID, and the VM Generation you will type:

    Get-VM | Select-Object VMname, VMID, Generation


    Regards, Samir Farhat Infrastructure and Virtualization Consultant || Virtualization, Cloud, Azure ? Follow and Ask here https://buildwindows.wordpress.com

    • Marked as answer by R.Alikhani Thursday, April 23, 2015 3:05 PM
    Thursday, April 23, 2015 2:44 PM

All replies

  • You can use this syntax:

    Get-VM | format-list VMname, VMID


    Regards, Samir Farhat Infrastructure and Virtualization Consultant || Virtualization, Cloud, Azure ? Follow and Ask here https://buildwindows.wordpress.com

    • Marked as answer by R.Alikhani Thursday, April 23, 2015 2:40 PM
    Thursday, April 23, 2015 2:16 PM
  • Or a better output format

    Get-VM | Select-Object VMname, VMID


    Regards, Samir Farhat Infrastructure and Virtualization Consultant || Virtualization, Cloud, Azure ? Follow and Ask here https://buildwindows.wordpress.com

    • Marked as answer by R.Alikhani Thursday, April 23, 2015 2:40 PM
    Thursday, April 23, 2015 2:17 PM
  • I forgot to tell you that you can list all the 'Get-VM' properties to use them in your command.

    Get-VM | Get-Member

    This will return you all the possible properties that you can select : Example : If you want to output the Name, VMID, and the VM Generation you will type:

    Get-VM | Select-Object VMname, VMID, Generation


    Regards, Samir Farhat Infrastructure and Virtualization Consultant || Virtualization, Cloud, Azure ? Follow and Ask here https://buildwindows.wordpress.com

    • Marked as answer by R.Alikhani Thursday, April 23, 2015 3:05 PM
    Thursday, April 23, 2015 2:44 PM
  • Just to add some color to the answers you have:

    the Get-VM cmdlet filters the properties returned to a small but immediately useful set.  There are for more properties that each VM possesses.

    Try:

    Get-VM * | Select *

    This will show you all of the properties of all of your VMs


    Brian Ehlert
    http://ITProctology.blogspot.com
    Learn. Apply. Repeat.

    Thursday, April 23, 2015 2:47 PM
    Moderator
  • Get-VM | format-list VMname, VMID, State

    Get-VM | where {$_.state -eq "Running"} | format-list VMname, VMID, State this will filter out non-running VM's

    I would add this. I got badly burnt when VM's were turned off or stopped. Get-VM | format-list VMname, VMID is blind to the VM state. Now you can check the state take action accordingly.

    VMName : LG1
    VMId   : 5b994318-63a9-47a5-9798-c063afe2d808
    State  : Running

    VMName : LG2
    VMId   : b53f5ef9-36b9-41b5-9508-8db7c7671cad
    State  : Running

    VMName : LG3
    VMId   : e5d330d7-a01e-4ce8-bed1-05deaa0d3989
    State  : Running

    VMName : LG4
    VMId   : c43c185e-1484-46e5-8971-5661c7eb7bd5
    State  : Running

    VMName : LGN
    VMId   : 103c3763-821d-4692-8e2b-8951e9b54411
    State  : Off



    Wednesday, March 13, 2019 4:39 PM