-
- Novice
- Posts: 5
- Liked: never
- Joined: Mar 17, 2015 2:38 pm
- Contact:
Add-VBRViJobObject Failing with 'Entities' Null
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 ?
-
- Product Manager
- Posts: 20400
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Add-VBRViJobObject Failing with 'Entities' Null
Can you provide your script here? Or at least a portion of it responsible for querying vCenter and assigning VMs to a variable? Thanks.
-
- Novice
- Posts: 5
- Liked: never
- Joined: Mar 17, 2015 2:38 pm
- Contact:
Re: Add-VBRViJobObject Failing with 'Entities' Null
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)
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)
-
- Novice
- Posts: 5
- Liked: never
- Joined: Mar 17, 2015 2:38 pm
- Contact:
Re: Add-VBRViJobObject Failing with 'Entities' Null
This command doesn't return anything if I run seperately, Find-VBRViEntity | Where {$_.Type -eq "Vm" -and $_.Reference -eq "vmMoRef" -and $_.Uuid -eq "vmUuid"}
-
- Product Manager
- Posts: 20400
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Add-VBRViJobObject Failing with 'Entities' Null
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:
Thanks.
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"
Who is online
Users browsing this forum: No registered users and 18 guests