VMware Cloud Community
SirHaschke
Enthusiast
Enthusiast
Jump to solution

Time Controlled Snapshot

Hello,
is it possible to plan a snapshot of a VM automatically via taskplaner etc.?

Thanks
Dennis

0 Kudos
1 Solution

Accepted Solutions
Seniore
Enthusiast
Enthusiast
Jump to solution

Hi Dennis,

you could use the Windows task scheduler to run a PowerCLI script.

New-Snapshot -VM $VM -Name $Snapshotname -description "$Snapshotdescription"

The other option is to vCenters "Scheduled Tasks" to create it.

View solution in original post

0 Kudos
3 Replies
Seniore
Enthusiast
Enthusiast
Jump to solution

Hi Dennis,

you could use the Windows task scheduler to run a PowerCLI script.

New-Snapshot -VM $VM -Name $Snapshotname -description "$Snapshotdescription"

The other option is to vCenters "Scheduled Tasks" to create it.

0 Kudos
brunofernandez1
Jump to solution

just quick and dirty Smiley Happy no error handling and nothing....

$Snapin = "VMware.VimAutomation.Core"

$vCenterServer = "hostnameofvcenteroresxi"

$User = "root"

$Password = "password"

$VM = "vmtest"

$SnapshotName = "foo"

$SnapshotDesc = "foo bar"

function LoadSnapin {

    param (

        $Snapin)

   

    process {

        If ((Get-PSSnapin $Snapin -ErrorAction SilentlyContinue) -eq $null)

            {

            Write-Host Loading Snapin $Snapin

            Add-PSSnapin $Snapin -WarningAction SilentlyContinue

            }

        }

    }

function ConnectVI {

    param (

        $vCenterServer)

            Write-Host 'Connecting to vCenter' $vCenterServer

            Connect-VIServer -Server $vCenterServer -User $User -Password $Password -WarningAction SilentlyContinue

    }

function DisconnectVI {

    param (

        $vCenterServer)

            Write-Host 'Disconnecting from vCenter' $vCenterServer

            Disconnect-VIServer $vCenterServer -Confirm:$false -WarningAction SilentlyContinue

    }

LoadSnapin $Snapin

ConnectVI $vCenterServer

New-Snapshot -VM $VM -Name $SnapshotName -Description $SnapshotDesc -Confirm:$false

DisconnectVI $vCenterServer

exit 0

------------------------------------------------------------------------------- If you found this or any other answer helpful, please consider to award points. (use Correct or Helpful buttons) Regards from Switzerland, B. Fernandez http://vpxa.info/
0 Kudos
SirHaschke
Enthusiast
Enthusiast
Jump to solution

Great,

this is fine:

VMware vSphere 5.1

Thanks

Dennis

0 Kudos