1

Having this code in powershell:

$Servers = "computer.domain.com"

# Open Session
$Session = New-PSSession -ComputerName $Servers

# Create Daily Checkpoints.
Invoke-Command -Session $Session -ScriptBlock {Get-Vm * | Checkpoint-Vm -SnapshotName "Daily Snapshot" –AsJob}

My snapshot is created but with default name, why is -SnapshotName parameter ignored?

Doing this from PS ISE works as expected...

johnymachine
  • 190
  • 1
  • 2
  • 12
  • Hi JohnyMachine, I have just tried your script and it worked first time for me. I copied your script word for word. You say it works in ISE, what error are you getting when you run it through the PowerShell console? – Michael Brown Mar 15 '17 at 13:18
  • On an unrelated note, is there a reason you're taking daily VM checkpoints? That's not necessarily a good idea from a performance perspective. – MDMarra Mar 15 '17 at 13:22
  • @MichaelBrown No error just the given name is not used. Is there any log I can check on remote host, that shows what command was executed? – johnymachine Mar 16 '17 at 07:26
  • @MDMarra Not really. It could be set for month in windows scheduler. It will be done in middle of the night and there will be second task, that deletes these checkpoints older than... – johnymachine Mar 16 '17 at 08:14

0 Answers0