PowerShell script exchange
Post Reply
slimer
Novice
Posts: 7
Liked: never
Joined: Nov 07, 2013 3:47 am
Full Name: Emil Juanillo
Contact:

Cannot find Resource Pool

Post by slimer » Nov 07, 2013 4:35 am

Hi,
I'm having issue in getting the resource pool using the new Veeam powershell command (find-VBRViResourcePool) it always return me null value. But when I used the old command (Find-VBRResourcePool) it give me this result:

Code: Select all

PS C:\temp\scripts> Find-VBRResourcePool -server $server
WARNING: This cmdlet is obsolete, use Find-VBRViResourcePool instead

Childs : {}
Type   : ResourcePool
Ref    : resgroup-8
Id     : resgroup-8
Name   : Resources
Path   : xxx/host/xxx Cluster/Resources
Parent : xxx Cluster

Please let me know what I missed or need to reconfigure, I need this to run Start-VBRInstantRecovery command. Below is my script that I used and running in Veeam version 6.0 restore.

Code: Select all

param(
$bkfJobName,
$rHost,
$prodVMname)

$jobsnames = get-vbrbackup | where {$_.JobName -eq "$bkfJobName"}
$res = Find-VBRResourcePool -Server ($rhost) | where {$_.Name -eq "Resources"}
$VMname = $prodVMname + "_test-restore"
$rp = get-vbrbackup | where {$_.JobName -eq "$bkfJobName"} | Get-VBRRestorePoint | where {$_.VMname -eq "$prodVMname"} | select-object -last 1
start-vbrinstantrecovery -RestorePoint ($rp) -VMname $VMname -server $rhost -ResourcePool $res -PowerUp $false -NICsEnabled $false -Reason "Test restore using powershell.
Thank you in advance.

veremin
Product Manager
Posts: 16892
Liked: 1435 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Cannot find Resource Pool

Post by veremin » Nov 07, 2013 11:01 am

How did you specify $server variable? Can you confirm that the server in question ($Server) does have resource pool named “Resources”?

Your problem looks interesting, as a quick test with Find-VBRViResourcePool and Find-VBRResourcePool commandlets suggests that the letter doesn’t output anything, in contrast to, Find-VBRViResourcePool that correctly shows all the resource pools that the specified server has.

Thanks.

tsightler
VP, Product Management
Posts: 5418
Liked: 2240 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Cannot find Resource Pool

Post by tsightler » Nov 07, 2013 12:21 pm

Can you post the output of the new command, the example above is the old command which doesn't work.

slimer
Novice
Posts: 7
Liked: never
Joined: Nov 07, 2013 3:47 am
Full Name: Emil Juanillo
Contact:

Re: Cannot find Resource Pool

Post by slimer » Nov 08, 2013 1:56 am

Thanks for your reply.

@ v.Eremin:
I set:
$server = "vmhost.server.name.fqdn"
And for Resource Pool with name "Resources" it exist and able to select in Veeam GUI Console when I running the instant recovery. And also it is showing in old cod command Find-VBRResourcePool, like the result on my first post.


@ tsightler:
Find-VBRViResourcePool -server $server
(no result/null)


Here is my script to help to explain what I encountered in my environment.

=========================================================================================
$bkfJobName = "Server_name_"
$rHost = "VMhost1 in cluster"
$prodVMname = "Server_name"


if ( (Get-PSSnapin -Name VeeamPSSnapin -ErrorAction SilentlyContinue) -eq $null )
{
Add-PSSnapIn VeeamPSSnapin
}

$jobsnames = get-vbrbackup | where {$_.JobName -eq "$bkfJobName"}
$jobsnames

$rp = get-vbrbackup | where {$_.JobName -eq "$bkfJobName"} | Get-VBRRestorePoint | where {$_.VMname -eq "$prodVMname"} | select-object -last 1
$rp

$server = Get-VBRServer | where {$_.Name -eq "$rHost"}
$server

$res = Find-VBRViResourcePool -Server $server -Name Resources
#$res = "Resources"
$res

$VMname = $prodVMname + "_test-restore"
$VMname

start-vbrinstantrecovery -RestorePoint ($rp) -VMname $VMname -server $rhost -ResourcePool $res -PowerUp $false -NICsEnabled $false -Reason "Test restore using powershell."

================================================================================================================

when I ran it I got error on Start-VBRInstantRecovery.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Start-VBRInstantRecovery : Cannot validate argument on parameter 'ResourcePool'. The argument is null. Supply a non-nul
l argument and try the command again.
At C:\temp\scripts\test.ps1:27 char:90
+ start-vbrinstantrecovery -RestorePoint ($rp) -VMname $VMname -server $rhost -ResourcePool <<<< $res -PowerUp $false
-NICsEnabled $false -Reason "Test restore using powershell."
+ CategoryInfo : InvalidData: (:) [Start-VBRInstantRecovery], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Veeam.Backup.PowerShell.Command.StartVBRInstantRecovery
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


I hope this will help.
Thank you again.

tsightler
VP, Product Management
Posts: 5418
Liked: 2240 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Cannot find Resource Pool

Post by tsightler » Nov 08, 2013 2:38 am

So this ESXi host that you are restoring to is part of vCenter? I've noticed a few, let's say "interesting" behaviors with Find-VBRViResourcePool so you might want try Find-VBRViEntity instead, run something like this and see if you get a result:

Code: Select all

Find-VBRViEntity -ResourcePools -Server "<vcenter_name_fqdn>" -Name "Resources"

slimer
Novice
Posts: 7
Liked: never
Joined: Nov 07, 2013 3:47 am
Full Name: Emil Juanillo
Contact:

Re: Cannot find Resource Pool

Post by slimer » Nov 08, 2013 3:27 am

This command works perfectly and yes it's part of the vcenter with cluster. Now my script run without a problem.
What's wrong with the use of Find-VBRViResourcePool command, it seems it's not working in a clustered esxi.

Thank you very much.

tsightler
VP, Product Management
Posts: 5418
Liked: 2240 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Cannot find Resource Pool

Post by tsightler » Nov 08, 2013 4:18 am

I'm not really sure what's wrong with the Find-VBRViResourcePool command, but I've seen some inconsistency in some previous scripts. That being said, in your script above you were attempting to query the ESXi host for the resource pool, not the vCenter. Even so I would expect the two commands to behave the same, and they don't, even in my lab setup, however, Find-VBRViEntity should be able to find any object without the need for the object specific cmdlets so I just use it for everything.

slimer
Novice
Posts: 7
Liked: never
Joined: Nov 07, 2013 3:47 am
Full Name: Emil Juanillo
Contact:

Re: Cannot find Resource Pool

Post by slimer » Nov 08, 2013 5:46 am

Thank you for your help. I got my script updated.

veremin
Product Manager
Posts: 16892
Liked: 1435 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Cannot find Resource Pool

Post by veremin » Nov 08, 2013 7:56 am

I’m wondering what happens if instead of particular host in variable $server, you specify a corresponding vCenter. Will Find-VBRViResourcePool also work in this case or not?

Thanks.

tsightler
VP, Product Management
Posts: 5418
Liked: 2240 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Cannot find Resource Pool

Post by tsightler » Nov 08, 2013 12:56 pm

Hi Vladimir!

I'm pretty sure that Find-VBRViResourcePools is at least slightly broken in V7. Look at this result:

Code: Select all

PS C:\Users\notyouradmin> Find-VBRViResourcePool -Server "vc01.notyourdomain.com" -Name "Resources"

PS C:\Users\notyouradmin> Find-VBRViEntity -ResourcePools -Server "vc01.notyourdomain.com" -Name "Resources"

ConnHost  : Veeam.Backup.Core.CHost
Type      : ResourcePool
Reference : resgroup-12286
Id        : 5680e9bd-33f8-4698-8362-3bdd08df6e8c_resgroup-12286
Name      : Resources
Path      : vc01.notyourdomain.com\NotYourDatacenter\Prod Cluster\Resources
I would have expected both of those commands to return the exact same result, and as can be seen, I am querying vCenter, however, it appears that the Find-VBRViResourcePools command is unable to find the "root" resource pool. It also leaves this out in the path as well for example, look at this output for a query from a child resource pool:

Code: Select all

PS C:\Users\notyouradmin> (Find-VBRViEntity -ResourcePools -Server "vc01.notyourdomain.com" -Name "DR Pool").Path
vc01.notyourdomain.com\NotYourDatacenter\Prod Cluster\Resources\DR Pool

PS C:\Users\notyouradmin> (Find-VBRViResourcePool -Server "vc01.notyourdomain.com" -Name "DR Pool").Path
vc01.notyourdomain.com\NotYourDatacenter\Prod Cluster\DR Pool
So when looking for a child resource pool both commands returned a result, but the path for the Find-VBRViResourcePool command does not show the parent resource pool in the path.

If you query a specific ESXi host rather than vCenter Find-VBRViEntity appears to return the root resource pool only, while Find-VBRViResourcePool appears to find only child resources on the host. Once again I would expect the same results from both.

veremin
Product Manager
Posts: 16892
Liked: 1435 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Cannot find Resource Pool

Post by veremin » Nov 08, 2013 1:34 pm

It seems, indeed, that Find-VBRViResourcePool, in contrast to Find-VBRViEntity, doesn’t return “root” resource pool. So, if you want to specify “Resources” as a resource pool for replication job, you should use Find-VBRViEntity with corresponding switches (-ResourcePool).

So, thanks for pointing this issue out.

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests