PowerShell script exchange
Post Reply
Marge
Novice
Posts: 5
Liked: never
Joined: Sep 21, 2018 7:51 am
Full Name: Margherita
Contact:

Find-VbrViEntity with host unreachable

Post by Marge »

In my script i use Find-VBRViEntity to get entire vCenter VM hierarchy using VM and Template view, but if some host is unreachable the script get pinned.
I tried to use

Code: Select all

 -errorAction stop
without success.
I tried to ping each host to verify the connection and then use Find-VBRViEntity -server "name_Host", but the result is not list of vm of that host.

Anyone else got any suggestions?
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Find-VbrViEntity with host unreachable

Post by veremin »

I tried to ping each host to verify the connection and then use Find-VBRViEntity -server "name_Host", but the result is not list of vm of that host.

Not sure whether i got "not list of vm of that" portion. Can you provide more details, please? Thanks!
Marge
Novice
Posts: 5
Liked: never
Joined: Sep 21, 2018 7:51 am
Full Name: Margherita
Contact:

Re: Find-VbrViEntity with host unreachable

Post by Marge »

Hi Eremin, thank for your concern.
I try to explain better:
if i get this cmd

Code: Select all

Get-VBRServer -Name "dc-esx01", "dc-esx02" | Find-VBRViEntity -VmsAndTemplate
as a result i obtain this:

Code: Select all

ConnHostId : 0b04ef21-3c11-4e9f-ac60-d5503f5db25a
ConnHost   : Veeam.Backup.Core.Common.CHost
Type       : Esx
Reference  : host-11
Id         : 0b04ef21-3c11-4e9f-ac60-d5503f5db25a_host-11
Name       : dc-esx01
Path       : dc-esx01

ConnHostId : 0b04ef21-3c11-4e9f-ac60-d5503f5db25a
ConnHost   : Veeam.Backup.Core.Common.CHost
Type       : Esx
Reference  : host-25
Id         : 0b04ef21-3c11-4e9f-ac60-d5503f5db25a_host-25
Name       : dc-esx02
Path       : dc-esx02
if i get this other command:

Code: Select all

find-VBRViEntity -VmsAndTemplate
as result i obtain:

Code: Select all

Id                                               				 Name                              		Path
--                                              				  ----                             		 ----
49500DBE-39E7-4A3E-A48B-3F995D1EFF63              VMs and Templates
0b04ef21-3c11-4e9f-ac60-d5503f5db25a              vcenter65.ricca-it.local          vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_datacenter-2 Datacenter                        vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_vm-1255      IBM Spectrum Protect Plus         vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_vm-210       TSM-TEST                          vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_group-v128   Cloud                             vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_vm-4718      eSiem                             vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_vm-84        iMoc-AD_Cloud                     vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_vm-92        e-Clean                           vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_vm-79        zPfsense_Cloud                    vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_vm-260       ecare-db		                  vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_vm-323       ZDashboard_Cloud                  vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_vm-66        ZDashboard_Test_Cloud             vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_vm-327       zCalio_Cloud                      vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_vm-6401      				                     vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_vm-211       UPS_Management                    vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_group-v143   		                              vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_vm-257       G_SRV-WEB-PRO                     vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_vm-256       G_SRV-WEB                         vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_group-v133   Datacore                          vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_vm-22        Dcore01                           vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_vm-27        Dcore02                           vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_group-v24    Discovered virtual machine        vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_vm-974       CentOS7                           vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_group-v129   Infrastruttura                    vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_vm-23        vcenter65                         vcenter65
0b04ef21-3c11-4e9f-ac60-d5503f5db25a_vm-6686      FortiManager                      vcenter65
If dc-esx01 or dc-esx02 is unreachable the command Find-VBRviEntity not respond and my script go in timeout.
I would want the name of Vm for selected server
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Find-VbrViEntity with host unreachable

Post by veremin »

I was more talking about "pinging and getting no VM list as a result" situation.

Anyway, it seems that you should ping host in advance, using PowerCLI and then execute or Find-VBRViEntity cmdlet, based on the ping results you get. Thanks!
Marge
Novice
Posts: 5
Liked: never
Joined: Sep 21, 2018 7:51 am
Full Name: Margherita
Contact:

Re: Find-VbrViEntity with host unreachable

Post by Marge »

what do you mean with "using powerCLI" ?
I ping the host connected with this code:

Code: Select all

 $server= Get-VBRServer -type ESXi
$ping= new-Object System.net.networkinformation.ping
$ServerPing=@()
$serverReachable=@()
foreach($item in $server){
$ServerPing+=$ping.send($item.name)
if($ServerPing.status -eq "Success"){$serverReachable += $item}
}
#$ServerPing
#$serverReachable

$vm=@()
foreach($item in $serverReachable){
$vm += Find-VBRviEntity -server $item.name 
 }
 $vm
but the result is this:

Code: Select all

ConnHostId : 0b04ef21-3c11-4e9f-ac60-d5503f5db25a
ConnHost   : Veeam.Backup.Core.Common.CHost
Type       : Esx
Reference  : host-11
Id         : 0b04ef21-3c11-4e9f-ac60-d5503f5db25a_host-11
Name       : dc-esx01
Path       : dc-esx01

ConnHostId : 0b04ef21-3c11-4e9f-ac60-d5503f5db25a
ConnHost   : Veeam.Backup.Core.Common.CHost
Type       : Esx
Reference  : host-25
Id         : 0b04ef21-3c11-4e9f-ac60-d5503f5db25a_host-25
Name       : dc-esx02
Path       : dc-esx02
I hope that now be more clear.
excuse for my bad english and thanks
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Find-VbrViEntity with host unreachable

Post by veremin »

What if you re-write your code slightly?

Code: Select all

$server= Get-VBRServer -type ESXi
$ping= new-Object System.net.networkinformation.ping
$ServerPing=@()
$serverReachable=@()
foreach($item in $server){
$ServerPing+=$ping.send($item.name)
if($ServerPing.status -eq "Success"){$serverReachable += $item}
}
#$ServerPing
#$serverReachable

$vm=@()
foreach($item in $serverReachable){
$vm += Find-VBRviEntity -server $item}
$vm
Marge
Novice
Posts: 5
Liked: never
Joined: Sep 21, 2018 7:51 am
Full Name: Margherita
Contact:

Re: Find-VbrViEntity with host unreachable

Post by Marge »

i'm sorry, in the last reply i posted a code portion that doesn't get the output i wanted.
But my problem is the same.
I would want the list of Vm for each host
Marge
Novice
Posts: 5
Liked: never
Joined: Sep 21, 2018 7:51 am
Full Name: Margherita
Contact:

Re: Find-VbrViEntity with host unreachable

Post by Marge »

I' sorry,
in the last reply i posted the code portion doesn't get the output i wanted.
In the documentation i read this:
Find-VbrViEntity with parameter -server
"SERVER:Specifies the array of ESX(i) hosts. The cmdlet will return entities created on these hosts."
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Find-VbrViEntity with host unreachable

Post by veremin »

Server parameter accepts CHost object, not string one. Find-VBRViEntity returns everything you, it's just VeeamPSSnapin being executed from backup console that provides fancy outlook.

You can use returned object and select whatever properties you like:

Code: Select all

$vm | select Id, Name, Path
Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests