Add-VBRViJobObject Failing with 'Entities' Null

PowerShell script exchange

Add-VBRViJobObject Failing with 'Entities' Null

Veeam Logoby cloud00hawk » Tue Mar 17, 2015 3:43 pm

We have a PS Script that adds VMs to backup jobs. It was working for almost past 20months. All of a sudden it stopped working and failing with 'Entities' Null error. It looks like it can't pull vCenter VMs anymore. Anyone ran into this issue before ?
cloud00hawk
Novice
 
Posts: 5
Liked: never
Joined: Tue Mar 17, 2015 2:38 pm

Re: Add-VBRViJobObject Failing with 'Entities' Null

Veeam Logoby v.Eremin » Tue Mar 17, 2015 4:22 pm

Can you provide your script here? Or at least a portion of it responsible for querying vCenter and assigning VMs to a variable? Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Add-VBRViJobObject Failing with 'Entities' Null

Veeam Logoby cloud00hawk » Tue Mar 17, 2015 4:37 pm

Command: Add-VBRViJobObject -Job $(get-VBRjob -Name "jobName") -Entities $(Find-VBRViEntity | Where {$_.Type -eq "Vm" -and $_.Reference -eq "vmMoRef" -and $_.Uuid -eq "vmUuid"})

Output: PowerShellInvocationError: Errors found while executing script
System.Management.Automation.ParameterBindingValidationException: Cannot validate argument on parameter 'Entities'. The argument is null. Supply a non-null argument and try the command again. ---> System.Management.Automation.ValidationMetadataException: The argument is null. Supply a non-null argument and try the command again.
at System.Management.Automation.ValidateNotNullAttribute.Validate(Object arguments, EngineIntrinsics engineIntrinsics)
at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
--- End of inner exception stack trace ---
at System.Management.Automation.StatementListNode.ExecuteStatement(ParseTreeNode statement, Array input, Pipe outputPipe, ArrayList& resultList, ExecutionContext context)
at System.Management.Automation.StatementListNode.Execute(Array input, Pipe outputPipe, ArrayList& resultList, ExecutionContext context)
at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, Boolean writeErrors, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, ArrayList& resultList, Object[] args)
at System.Management.Automation.ScriptBlock.InvokeUsingCmdlet(Cmdlet contextCmdlet, Boolean UseLocalScope, Boolean writeErrors, Object dollarUnder, Object input, Object scriptThis, Object[] args)
at Microsoft.PowerShell.Commands.InvokeExpressionCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
(Dynamic Script Module name : invokeScript#14)
cloud00hawk
Novice
 
Posts: 5
Liked: never
Joined: Tue Mar 17, 2015 2:38 pm

Re: Add-VBRViJobObject Failing with 'Entities' Null

Veeam Logoby cloud00hawk » Tue Mar 17, 2015 4:38 pm

This command doesn't return anything if I run seperately, Find-VBRViEntity | Where {$_.Type -eq "Vm" -and $_.Reference -eq "vmMoRef" -and $_.Uuid -eq "vmUuid"}
cloud00hawk
Novice
 
Posts: 5
Liked: never
Joined: Tue Mar 17, 2015 2:38 pm

Re: Add-VBRViJobObject Failing with 'Entities' Null

Veeam Logoby v.Eremin » Wed Mar 18, 2015 11:09 am

What you're trying to achieve with the use of that code? I mean either Reference or UUID identifies VM unequivocally, so, I don't see the reason to use them both at the same time.

If you want to get a particular VM, you can try the following code, instead:

Code: Select all
Find-VBRViEntity -VMsAndTemplates -Name "Name of VM"


Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 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 3 guests