View Only
  • 1.  PowerShell CLI snapshot

    Posted Jul 10, 2023 04:12 PM


    I am attempting to create a somewhat automated snapshot method for server patching. We use a 3rd party software distribution to push patches. This allows us to push PowerShell scripts also as a part of the steps before installing patches.

    Id like to be able add in a script to take a snapshot before pushing updates. I have figured out how to connect the server and take the snapshot but Id like to be able to have it wait and give me a confirmation that it completed before completing the script. Any suggestions or help?

    vSphere Client version

    So far I've got.

    Connect-VIServer -Server ServerIPAddress
    Start-Sleep -Seconds 10
    New-Snapshot -VM "VMNAME" -Name testsnapshot -Memory $true

    This returns back with

    Name Port User
    ---- ---- ----
    ServerIPAddress 443 LH\service_account

    New-Snapshot : A positional parameter cannot be found that accepts argument 'True'.
    At line:3 char:1
    + New-Snapshot -VM "LHW10LAB" -Name PDQsnapshot -Memory $true
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [New-Snapshot], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.NewSnapshot


  • 2.  RE: PowerShell CLI snapshot
    Best Answer

    Posted Jul 11, 2023 03:11 PM

    Try with this:

    New-Snapshot -VM "VMNAME" -Name testsnapshot -Memory:$true

    (notice colon after -Memory)

  • 3.  RE: PowerShell CLI snapshot

    Posted Jul 11, 2023 03:39 PM

    That worked, Thanks!