KristianW
Contributor
Contributor

Getting snapshot/Vm information

Jump to solution

Hi all,

I am somewhat of a newbie on PowerShell and scripting but got the basics down (and the ability to search the interweb) Smiley Happy

However I can't seem to find any oneliners, or scripts that does what I want. I almost got there with a oneliner myself - put almost is not good enough.

What I want is to list all VMs with snapshost and the following information:

VM name

VM description (name of contact person is here and I am contemplating on putting contactpersons email adresse here)

Snapshot name

Snapshot description

Snapshot creation date.

I found that get-vm | select Name, Description gives me the info on the VM.

I found that get-snapshost | select Name, Description, Created gives me the info on the snapshots. But combined it does not give me all I want.

What almost got me there was: get-vm | get-snapshot | select VM, Name, Description, Created

This does not give med the description on given VM. What it gives me is VMs name, Snapshosts name, Snapshots description and created date.

Any one with any pointers?

Best regards,

Kristian

0 Kudos
1 Solution

Accepted Solutions
esarakaitis
Enthusiast
Enthusiast

something like this?

Get-VM | Get-Snapshot | `
    Select @{Name="VM"; Expression={$_.VM.Name}},
           @{Name="VM_Description"; Expression={$_.VM.Description}},
           @{Name="Snapshot"; Expression={$_.Name}},
           @{Name="Snapshot_Description"; Expression={$_.Description}}

http://www.vmwarescripting.com

View solution in original post

0 Kudos
5 Replies
esarakaitis
Enthusiast
Enthusiast

something like this?

Get-VM | Get-Snapshot | `
    Select @{Name="VM"; Expression={$_.VM.Name}},
           @{Name="VM_Description"; Expression={$_.VM.Description}},
           @{Name="Snapshot"; Expression={$_.Name}},
           @{Name="Snapshot_Description"; Expression={$_.Description}}

http://www.vmwarescripting.com

0 Kudos
KristianW
Contributor
Contributor

Hi again,

And thank you for your swift response esarakaitis

This looks like it does exactly what I want ! Now I just have to get it presented in a nice fashion!

Thank you again esarakaitis!

regards,

Kristian

0 Kudos
esarakaitis
Enthusiast
Enthusiast

anytime, you could always use the built-in option of export to csv

http://www.vmwarescripting.com

0 Kudos
KristianW
Contributor
Contributor

I have done so. Export-csv is my friend Smiley Happy

Kristian

0 Kudos