PowerCLI

 View Only
Expand all | Collapse all

Get-VM | Snapshots | VM, Name -> missing VM-name

  • 1.  Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 06, 2026 10:29 AM

    Hi,
    Get-VM | Snapshots | VM, Name i get this output.

    image


    Why is the VM-Name missing?

    Regards
    Dennis



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


  • 2.  RE: Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 07, 2026 01:16 AM
    Edited by rkabelich Jan 07, 2026 01:35 AM

    Hi Dennis, 

    Get-VM | Get-Snapshot | Select-Object -Property VM,Name

    This should work for you. 

    If you want to get a file output with some more properties, use this script and replace the data inside angle brackets (remove angle brackets too) with your data. 

    Disconnect-VIServer * -Confirm:$false
    
    $VIServer = "<your vcenter url>"
    Connect-VIServer $VIServer 
    
    Get-VM | Get-Snapshot | Select-Object -Property VM,Name,Id,Description,Created,SizeGB | sort -Property "Created" | export-csv -force -NoType $fullPath -delimiter ';'
    
    Disconnect-VIServer * -confirm:$false
    
    exit
    

    Regards
    Ronald 



  • 3.  RE: Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 07, 2026 01:35 AM
    Edited by ITSavant Jan 07, 2026 01:36 AM

    And if you have a lot of VMs, do this, it will run 10x faster:

    Get-View -ViewType VirtualMachine -Property Name, Snapshot | ?{$_.Snapshot} | Get-VIObjectByView | Get-Snapshot | Select-Object VM, Name

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



  • 4.  RE: Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 07, 2026 01:41 AM
    Edited by rkabelich Jan 07, 2026 01:49 AM

    Thanks for the improvement! 

    It can of course also be used in the script. 

    Get-VIObjectByView should be replaced by Get-VIObjectByVIView

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



  • 5.  RE: Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 07, 2026 01:56 AM

    Hi Dennis,

    Try as below

    Get-VM | Get-Snapshot | Select @{N='VMName';E={$_.VM.Name}}, Name, Created | ft -auto

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



  • 6.  RE: Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 07, 2026 02:17 AM

    Hi All,
    thanks. But nothing works for me :-(

    image
    image
    image




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



  • 7.  RE: Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 07, 2026 02:23 AM

    Try and paste output please. 

    Get-VM | Get-Snapshot | fl
    -------------------------------------------



  • 8.  RE: Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 07, 2026 02:26 AM

    can you post the output of Get-Snapshot | Select *
    without the Named Expressions so we can see what is happening

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



  • 9.  RE: Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 07, 2026 02:44 AM

    I just tested on several vCenters and had the same results, Get-Snapshot is not populating the vm property

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



  • 10.  RE: Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 07, 2026 02:53 AM
    Edited by ITSavant Jan 07, 2026 11:20 AM

    This does work, albeit, shouldn't need to make a secondary call

    Get-View -ViewType VirtualMachine -Property Name, Snapshot | ?{$_.Snapshot} | Get-VIObjectByVIView | Get-Snapshot | Select-Object @{n='VM';e={(Get-View -Id $_.VMID -Server $_.Uid.Split('@')[1].Split(':')[0] -Property Name).Name}}, Name

    Silly to have to do it this way but it works

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



  • 11.  RE: Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 07, 2026 02:47 AM

    This is a part of the output:

    Description       : snappi report
    Created           : 06.01.2026 15:40:25
    Quiesced          : False
    PowerState        : PoweredOff
    VM                : 
    VMId              : VirtualMachine-vm-176947
    Parent            : 
    ParentSnapshotId  : 
    ParentSnapshot    : 
    Children          : 
    SizeMB            : 
    SizeGB            : 
    IsCurrent         : True
    IsReplaySupported : False
    ExtensionData     : VMware.Vim.VirtualMachineSnapshotTree
    Name              : VM Snapshot 1/6/2026, 3:39:30 PM
    Id                : VirtualMachineSnapshot-snapshot-181660
    Uid               : /VIServer=vsphere.local\administrator@vcenter1:443/Snapshot=VirtualMachineSnapshot-snapshot-181660/

    Description       : Update
    Created           : 09.12.2025 08:24:47
    Quiesced          : False
    PowerState        : PoweredOn
    VM                : 
    VMId              : VirtualMachine-vm-149647
    Parent            : 
    ParentSnapshotId  : 
    ParentSnapshot    : 
    Children          : 
    SizeMB            : 
    SizeGB            : 
    IsCurrent         : True
    IsReplaySupported : False
    ExtensionData     : VMware.Vim.VirtualMachineSnapshotTree
    Name              : VM Snapshot 12/9/2025, 8:24:42 AM
    Id                : VirtualMachineSnapshot-snapshot-177107
    Uid               : /VIServer=vsphere.local\administrator@vcenter1:443/Snapshot=VirtualMachineSnapshot-snapshot-177107/

    Description       : 15.12.25_Umzug_Green_Zone
    Created           : 15.12.2025 08:05:52
    Quiesced          : False
    PowerState        : PoweredOn
    VM                : 
    VMId              : VirtualMachine-vm-152876
    Parent            : 
    ParentSnapshotId  : 
    ParentSnapshot    : 
    Children          : 
    SizeMB            : 
    SizeGB            : 
    IsCurrent         : True
    IsReplaySupported : False
    ExtensionData     : VMware.Vim.VirtualMachineSnapshotTree
    Name              : VM-Snapshot 15.12.2025, 08:05:47
    Id                : VirtualMachineSnapshot-snapshot-178082
    Uid               : /VIServer=vsphere.local\administrator@vcenter1:443/Snapshot=VirtualMachineSnapshot-snapshot-178082/

    Description       : 
    Created           : 26.11.2025 16:59:21
    Quiesced          : False
    PowerState        : PoweredOn
    VM                : 
    VMId              : VirtualMachine-vm-113055
    Parent            : 
    ParentSnapshotId  : 
    ParentSnapshot    : 
    Children          : 
    SizeMB            : 
    SizeGB            : 
    IsCurrent         : True
    IsReplaySupported : False
    ExtensionData     : VMware.Vim.VirtualMachineSnapshotTree
    Name              : VM-Snapshot 26.11.2025, 16:59:15
    Id                : VirtualMachineSnapshot-snapshot-175052
    Uid               : /VIServer=vsphere.local\administrator@vcenter1:443/Snapshot=VirtualMachineSnapshot-snapshot-175052/

    Description       : 
    Created           : 15.12.2025 08:07:29
    Quiesced          : False
    PowerState        : PoweredOff
    VM                : 
    VMId              : VirtualMachine-vm-170772
    Parent            : 
    ParentSnapshotId  : 
    ParentSnapshot    : 
    Children          : 
    SizeMB            : 
    SizeGB            : 
    IsCurrent         : True
    IsReplaySupported : False
    ExtensionData     : VMware.Vim.VirtualMachineSnapshotTree
    Name              : VM-Snapshot 15.12.2025, 08:07:27
    Id                : VirtualMachineSnapshot-snapshot-178081
    Uid               : /VIServer=vsphere.local\administrator@vcenter1:443/Snapshot=VirtualMachineSnapshot-snapshot-178081/

    Description       : 
    Created           : 15.12.2025 08:07:22
    Quiesced          : False
    PowerState        : PoweredOn
    VM                : 
    VMId              : VirtualMachine-vm-170771
    Parent            : 
    ParentSnapshotId  : 
    ParentSnapshot    : 
    Children          : 
    SizeMB            : 
    SizeGB            : 
    IsCurrent         : True
    IsReplaySupported : False
    ExtensionData     : VMware.Vim.VirtualMachineSnapshotTree
    Name              : VM-Snapshot 15.12.2025, 08:07:20
    Id                : VirtualMachineSnapshot-snapshot-178084
    Uid               : /VIServer=vsphere.local\administrator@vcenter1:443/Snapshot=VirtualMachineSnapshot-snapshot-178084/




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



  • 12.  RE: Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 07, 2026 03:02 AM

    I created a new snap in our test environment and all the data is visible: 

    PS U:\> Get-VM | Get-Snapshot | fl


    Description       : test
    Created           : 07.01.2026 08:58:32
    Quiesced          : False
    PowerState        : PoweredOff
    VM                : TestESXInstall
    VMId              : VirtualMachine-vm-719876
    Parent            :
    ParentSnapshotId  :
    ParentSnapshot    :
    Children          :
    SizeMB            : 1,0199260711669921875
    SizeGB            : 0,0009960215538740158081054688
    IsCurrent         : True
    IsReplaySupported : False
    ExtensionData     : VMware.Vim.VirtualMachineSnapshotTree
    Id                : VirtualMachineSnapshot-snapshot-726880
    Name              : VM Snapshot 7.1.2026, 08:58:26

    What versions do you use? vCenter,Powershell etc? 

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



  • 13.  RE: Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 07, 2026 03:13 AM

    Then i get this error:

    image
    Versions:
    image
    OS: Windows Server 2025.
    vCenter 8.0.3.00600

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



  • 14.  RE: Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 07, 2026 03:55 AM
    Edited by rkabelich Jan 07, 2026 03:58 AM

    Okay, then I'm stumped. Your versions are newer than ours and it does not work.

    PS U:\> $PSVersionTable

    Name                           Value
    ----                           -----
    PSVersion                      5.1.20348.4294
    PSEdition                      Desktop
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
    BuildVersion                   10.0.20348.4294
    CLRVersion                     4.0.30319.42000
    WSManStackVersion              3.0
    PSRemotingProtocolVersion      2.3
    SerializationVersion           1.1.0.1

    PS U:\> get-module | ft -AutoSize

    ModuleType Version         Name
    ---------- -------         ----
    Manifest   3.1.0.0         Microsoft.PowerShell.Management
    Manifest   3.0.0.0         Microsoft.PowerShell.Security
    Manifest   3.1.0.0         Microsoft.PowerShell.Utility
    Manifest   3.0.0.0         Microsoft.WSMan.Management
    Script     0.0             onecli_completion
    Script     2.0.0           PSReadline
    Script     7.0.3.18730922  VMware.Vim
    Script     12.4.0.18627057 VMware.VimAutomation.Cis.Core
    Script     12.4.0.18627061 VMware.VimAutomation.Common
    Script     12.4.0.18627056 VMware.VimAutomation.Core
    Script     12.4.0.18627054 VMware.VimAutomation.Sdk

    May be it's a bug. I hope somebody else has a hint, I'm out of ideas. :-/ 

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



  • 15.  RE: Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 07, 2026 04:00 AM
    Edited by SirHaschke Jan 07, 2026 04:01 AM

    The strange thing is i had run the script on a Server 2022 with VIM 7.0.xx.
    On this server it works fine.
    But i will migrate the server to a new one ( Server 2025) and it doesn't work.

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



  • 16.  RE: Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 07, 2026 04:08 AM

    Ok, seems to be a bug in vim 8 or 9. 
    Until it's solved you should leave one 2022 Server to run your scripts. 

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



  • 17.  RE: Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 07, 2026 04:24 AM

    I had downgrade VIM to the same version like on the old server (2022).
    But it doesn't work too. What ever it is :-(

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



  • 18.  RE: Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 07, 2026 11:20 AM

    Sorry I typed from memory, had a typo, try this:

    Get-View -ViewType VirtualMachine -Property Name, Snapshot | ?{$_.Snapshot} | Get-VIObjectByVIView | Get-Snapshot | Select-Object @{n='VM';e={(Get-View -Id $_.VMID -Server $_.Uid.Split('@')[1].Split(':')[0] -Property Name).Name}}, Name

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



  • 19.  RE: Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 07, 2026 11:17 AM

    I have noticed that depending on other modules loaded/available to your PowerShell, they may load assemblies newer than the VMware versions, creating conflicts. Since Broadcom bought VMware PowerCLI seems to be falling behind in development. On some of my systems Get-View ($xxx.ExtensionData is the same thing) return no data, and I tracked it down to conflicting assemblies, causing the older VMware versions in PowerCli to loose.

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



  • 20.  RE: Get-VM | Snapshots | VM, Name -> missing VM-name

    Posted Jan 08, 2026 02:43 AM
      |   view attached

    Yes, this works fine:

    Get-View -ViewType VirtualMachine -Property Name, Snapshot | ?{$_.Snapshot} | Get-VIObjectByVIView | Get-Snapshot | Select-Object @{n='VM';e={(Get-View -Id $_.VMID -Server $_.Uid.Split('@')[1].Split(':')[0] -Property Name).Name}}, Name

    I have a script at the attachment.....is it possible to integrate this in the script?

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

    Attachment(s)