Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Create VMWare Snapshot - PowerShell/PowerCLI - How?

Hi - I'm losing my mind trying to figure this out - any help would be great!

I want to run some PowerShell/PowerCLI steps/commands/installs - whatever - to take a VM snapshot prior to deploying Windows OS Update pakages.

I can run a PowerShell script on the target machine manually and it works. 
The script, basically does this:


Import-module vmware.viautomation.core

$Credentials = Get-VICredentialStoreItem - host myvCentre -file <mycredential.xml>

Connect-VIServer -Server myvCentre -user $Credential.user -password $Credential.password

New-Snapshot -VM hostname -Name "Pre-Update Snapshot" -Description "whatever...."


Question - what's the proper way to do this - have the XML and ps1 script already on the target computers and my PDQ step is execute the remote script - or - bake these commands into a PDQ script in PDQ Deploy.