0

I want to export all my VirtualBox VMs for backup purpose using an automated script. The following command should do the export in my PS script:

cmd.exe -c "vboxmanage export Antergos -o D:\Temp\test.ova"

By running the vboxmanage command in PowerShell, It shows me the progress in 10% steps like this:

PS C:\Users\XYZ> vboxmanage export Antergos -o D:\Temp\test.ova
0%...10%...

But using the cmd call like above I don't get any output. It would be great to have some progress, since some VMs are quite big (~70GB). I tried different variations:

iex 'vboxmanage export "$($name)" -o "$targetFile"'
& "vboxmanage export ""$($name)"" -o ""$targetFile"""
Invoke-Command -ScriptBlock { cmd.exe /c "vboxmanage export ""$name"" -o ""$fullTargetFile""" 4>&1 } 4>&1
Invoke-Expression "vboxmanage export ""${name}"" -o ""${fullTargetFile}"" 2>&1"

None of them show me the progress, which seems wired to me since e.g. Invoke-Expression "vboxmanage --help" print the help, but no progress when using vboxmanage export live above.

1 Answer 1

0

I did it the following way and the vboxmanager output is shown for all operations.

$vmanagerBackup = @("VBoxManage.exe")
$vmanagerBackup += "export"
$vmanagerBackup += $vmName
$vmanagerBackup += "--ovf10"
$vmanagerBackup += $backupFilename
$vmanagerBackup = $vmanagerBackup -join ' '
Invoke-Expression "$vmanagerBackup"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.