PowerShell script exchange
Post Reply
cloud00hawk
Novice
Posts: 5
Liked: never
Joined: Mar 17, 2015 2:38 pm
Contact:

Add-VBRViJobObject Failing with 'Entities' Null

Post by cloud00hawk »

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

Re: Add-VBRViJobObject Failing with 'Entities' Null

Post by veremin »

Can you provide your script here? Or at least a portion of it responsible for querying vCenter and assigning VMs to a variable? Thanks.
cloud00hawk
Novice
Posts: 5
Liked: never
Joined: Mar 17, 2015 2:38 pm
Contact:

Re: Add-VBRViJobObject Failing with 'Entities' Null

Post by cloud00hawk »

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: Mar 17, 2015 2:38 pm
Contact:

Re: Add-VBRViJobObject Failing with 'Entities' Null

Post by cloud00hawk »

This command doesn't return anything if I run seperately, Find-VBRViEntity | Where {$_.Type -eq "Vm" -and $_.Reference -eq "vmMoRef" -and $_.Uuid -eq "vmUuid"}
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Add-VBRViJobObject Failing with 'Entities' Null

Post by veremin »

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

Who is online

Users browsing this forum: No registered users and 20 guests