bruins05G
Contributor
Contributor

Powercli script to perform vCenter 6 snasphots from csv

Hello,

We have a group of servers that we want to perform operating system patches. We would like to first take a snapshot of these servers. Does anyone have a powercli script in which it will read a csv of the server names and go out and perform a snapshot and give the snapshot a name specified in the script? We are using vCenter 6. Thanks.

0 Kudos
1 Reply
LucD
Leadership
Leadership

You mean something like this?

# CSV layout

# VMName

# vm1

# vm2

#

$snapName = 'MySnap'

Import-Csv -Path C:\vmnames.csv -UseCulture | %{

    Get-VM -Name $_.VMName | New-Snapshot -Name $snapName -Memory:$false -Confirm:$false

}


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

0 Kudos