PowerShell script exchange
Post Reply
mkobes
Service Provider
Posts: 15
Liked: never
Joined: Nov 21, 2016 9:14 am
Contact:

Problem with adding VM's to Job

Post by mkobes »

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
nielsengelen
Product Manager
Posts: 5635
Liked: 1181 times
Joined: Jul 15, 2013 11:09 am
Full Name: Niels Engelen
Contact:

Re: Problem with adding VM's to Job

Post by nielsengelen »

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.
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
veremin
Product Manager
Posts: 20283
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Problem with adding VM's to Job

Post by veremin »

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?
mkobes
Service Provider
Posts: 15
Liked: never
Joined: Nov 21, 2016 9:14 am
Contact:

Re: Problem with adding VM's to Job

Post by mkobes »

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.
veremin
Product Manager
Posts: 20283
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Problem with adding VM's to Job

Post by veremin »

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.
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests