I'm new to the forum and new to running Veeam backup in PowerShell. I've written some PowerShell/PowerCLI scripts before to do some tasks, but never having to backup a VM to a location using Veeam. What I'd basically like to do is connect to a vCenter, get a list of VM's, perhaps from a specified VM folder, select the VM's to backup and then watch them backup one at a time. I feel something like this to get started would work:
Code: Select all
Get-Datacenter | select Name | Format-Table
$mydatacenter = Read-Host "Select a datacenter"
Get-Datacenter -Name $datacenter | Get-Folder -Type VM | sort Name | Format-Table
$myfolder = Read-Host "Choose a folder"
$vms = Get-Datacenter -Name $datacenter | Get-Folder -Name $myfolder -Type VM | Get-VM | sort Name | Out-GridView -OutputMode Multiple
foreach ($vm in $vms)
{
I was given a script (not sure where it came from) to look at and see if I could make it work this way, but I just don't know enough about it. I'm not sure how to put the code on here so it looks all pretty and is easier to read, so if someone can point that out for me that'd be great.
Thanks.