Problem with adding VM's to Job

PowerShell script exchange

Problem with adding VM's to Job

Veeam Logoby mkobes » Mon Mar 27, 2017 2:25 pm

Hello,

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


Rerunning our script we get errors adding the VM's.
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)

Can somebody help me with this?
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
mkobes
Service Provider
 
Posts: 14
Liked: never
Joined: Mon Nov 21, 2016 9:14 am

Re: Problem with adding VM's to Job

Veeam Logoby vmniels » Fri Mar 31, 2017 10:30 am

How are you trying to add the VM's? Or is this the specific command you are looking for? As you didn't post a line which adds something to a job.
VCP-DCV
Veeam Certified Engineer
http://foonet.be
vmniels
Veeam Software
 
Posts: 1515
Liked: 328 times
Joined: Mon Jul 15, 2013 11:09 am
Full Name: Niels Engelen

Re: Problem with adding VM's to Job

Veeam Logoby v.Eremin » Fri Mar 31, 2017 10:34 am

Is "iVMMx01.ISIS.CORP" name of your new SCVMM server? Have you already removed the old SCVMM from a console? If you run Get-VBRServer without any naming filters, how many SCVMM servers will be returned?
v.Eremin
Veeam Software
 
Posts: 13281
Liked: 970 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Problem with adding VM's to Job

Veeam Logoby mkobes » Fri Mar 31, 2017 12:20 pm

Solved the issue! :)

The issue that got created was that when we had two SCVMM servers (with the same database contents) Veeam also saw two of the same objects (VM's).

We resolved the issue by removing all jobs, removing both SCVMM servers, removing all windows servers related to SCVMM. After this we addes the new SCVMM server to Veeam, recreated all jobs and mapped the new backup jobs to the old backup chains.
mkobes
Service Provider
 
Posts: 14
Liked: never
Joined: Mon Nov 21, 2016 9:14 am

Re: Problem with adding VM's to Job

Veeam Logoby v.Eremin » Fri Mar 31, 2017 1:25 pm

That's what I thought - presence of two SCVMM servers at the same time must have confused both product db and PS commands that rely on it.

Glad to hear you've solved the issue.
v.Eremin
Veeam Software
 
Posts: 13281
Liked: 970 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 4 guests