We installed a new SCVMM server last weekend in our enveiromont replacing the old one.
So a VM is linked to a job with the reference to the old SCVMM server.
I added the New SCVMM server to the backup & replication console and tried removing the old one.
This resulted in an problem: the old backup jobs still have references to the old SCVMM server.
So: i need to remove the VM's from the old SCVMM server, and add the VM's again by referencing to their new SCVMM server.
Here comes powershell
We have a script that daily fills our backups jobs by looking at custom properties defined in SCVMM and checks if the VM is in a job or not.
So my plan was to completely remove the VM's from the all the jobs and let the jobs fill again by runing our script to fill the jobs.
For example i use the following code to remove a virtual machine from the job:
Code: Select all
Get-VBRJob -Name "JOBNAME" | Get-VBRJobObject -Name "VMNAME" | Remove-VBRJobObject
Getting the VBRHvEntity idividualy:
Code: Select all
Get-VBRServer -Name "SCVMM_SERVER" | Find-VBRHvEntity -Name "VMNAME"
Code: Select all
PS C:\Windows\system32> Get-VBRServer -Name "iVMMx01.ISIS.CORP" | Find-VBRHvEntity -Name "iAD001"
[b]Output:[/b]
ConnHostId : fwege4w9fhwe9fjhweuipr (HOSTID)
ConnHost : Veeam.Backup.Core.CHvDbScvmm
Type : Vm
Reference : wefwefwervbwergvwegwegwergv (REFERENCE)
Id : ef0ui32=8renofvc349utr934uf4n (IDNAME)
Name : VMNAME
Path : SCVMM_SERVER\All Hosts\FOLDER\Clusters\CLUSTERNAME\VMNAME
VmHostName : VMHOSTNAME
PowerState : PoweredOn
ProvisionedSize : 0
UsedSize : 0
GuestInfo : Veeam.Backup.Model.CGuestInfo
Platform : EHyperV
WARNING: System.NullReferenceException: Object reference not set to an instance of an object.
at Veeam.Backup.Core.HyperV.CHvCache2.ListClusteredVms(IHvCacheRequest cacheRequest, CHvDbCluster dbCluster)
at Veeam.Backup.Core.HyperV.CHvCluster.GetClusteredVmsFromListing(CHvDbCluster dbCluster)
at Veeam.Backup.Core.Infrastructure.CHvFullHierarchyCreator.GetChildren(CHvClusterItem parent, Boolean bContainersOnly)
at Veeam.Backup.PowerShell.Private.CPSFlatHierarchy.Add(IItem item, ICollection`1 list)
at Veeam.Backup.PowerShell.Private.CPSFlatHierarchy.Add(IItem item, ICollection`1 list)
For some reason we can't add the VM's by script but can manualy searching for the VM in the job editor. (we have about 300 VM's in backup and 100 jobs so i would like to change this by script).
Kind regards,
Malcolm