PowerCLI script for patch management

22 views Asked by At

We're evaluating a patch management tool, to make it easier to deploy security patches. The tool has the ability to run a script prior to patching a server. I would like to have it run a script that simply takes a VMWare snapshot. So the overall process would be:

  1. Patch management system reaches out to target server and runs a script.
  2. Script creates a VMWare snapshot. I would like the name of the snapshot to simply be the date.
  3. Patch management system installs the patch on the server.
  4. We have a pretty good process in place already for deleting snapshots, so I don't need to script this part.

It's quite simple, really. All I need is item 2 above. That is to say, how do I run a script on any given server to create a snapshot of itself and name it according to the date?

I tried something like this, but of course it didn't work:

New-Snapshot -VM $hostname -Name $date

I know the syntax is wrong, but that's why I'm here. Thanks in advance!

0

There are 0 answers